Welcome Guest, Not a member yet? Register   Sign In
php preg_replace function
#12

[eluser]basty_dread[/eluser]
here is what i did
Code:
$string = "the quick brown brown fox jumps over the lazy dog, Brown Fox. <h2>The brown Fox</h2>";
$save = preg_replace('/<h.*>(.*)<\/h.*>/ie',"str_replace(' ','-','$1')" , $string);
print_r($save);

it output:

the quick brown brown fox jumps over the lazy dog, Brown Fox. The-brown-Fox

but it removes the <h2> tag? hehe
now i know how to use $1
thanks. your explanation are a lot clearer than the manual..


Messages In This Thread
php preg_replace function - by El Forum - 03-03-2010, 02:55 AM
php preg_replace function - by El Forum - 03-03-2010, 09:27 AM
php preg_replace function - by El Forum - 03-03-2010, 06:50 PM
php preg_replace function - by El Forum - 03-04-2010, 09:20 AM
php preg_replace function - by El Forum - 03-07-2010, 06:31 PM
php preg_replace function - by El Forum - 03-07-2010, 09:39 PM
php preg_replace function - by El Forum - 03-07-2010, 11:14 PM
php preg_replace function - by El Forum - 03-07-2010, 11:16 PM
php preg_replace function - by El Forum - 03-07-2010, 11:21 PM
php preg_replace function - by El Forum - 03-07-2010, 11:24 PM
php preg_replace function - by El Forum - 03-07-2010, 11:40 PM
php preg_replace function - by El Forum - 03-07-2010, 11:49 PM
php preg_replace function - by El Forum - 03-07-2010, 11:58 PM
php preg_replace function - by El Forum - 03-08-2010, 12:06 AM
php preg_replace function - by El Forum - 03-08-2010, 01:05 AM
php preg_replace function - by El Forum - 03-08-2010, 07:34 AM
php preg_replace function - by El Forum - 03-08-2010, 06:16 PM
php preg_replace function - by El Forum - 03-08-2010, 09:55 PM
php preg_replace function - by El Forum - 03-09-2010, 03:16 AM
php preg_replace function - by El Forum - 03-09-2010, 06:43 AM
php preg_replace function - by El Forum - 03-09-2010, 07:36 PM
php preg_replace function - by El Forum - 03-09-2010, 07:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB