Hi to all,
My aim is to pickup the substring from the $test between <p> & </p> and having word "code" inside.
I m using following code::
$test = "before<p>my code is yyyyyyyyXH99</p><p>This is second line</p>after";
print strlen($test);print"<br>";
print eregi( "<p>.*code.*</p>" ,$test,$array);
print "<br>\$array[0] :: $array[0]";
I m getting the following output::
62
56
$array[0] ::
my code is yyyyyyyyXH99
This is second line
I dont wana "This is second line" in my output
Help in Searching with Regular Expression
Moderator: General Moderators
is this on a string or array????
for a string
double check, but i beleive the () make it return the text that matches instead of a 1 or 0
for a string
Code: Select all
$what_we_want=preg_match('|(<p>[\w\W]*code[\w\W]*</p>)|i', $text);double check, but i beleive the () make it return the text that matches instead of a 1 or 0