Connecting Tech Pros Worldwide Help | Site Map

regex and multiline problem

  #1  
Old July 17th, 2005, 01:16 PM
sinasalek
Guest
 
Posts: n/a
i have a problem below code :

[PHP]
<?php
$text='
<html dir="rtl">

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<p><a href="http://www.google.com/">gfsdfgsdgdsfgsdgsfd</a></p>
<p>aasdfasfasfasf</p>
<p>fasfasfasfsad</p>
<p>sdfaafdadsfsdfa</p>
<p><A href=http://www.orkut.com/>
<img border="0" src="file:///D:/My%20Documents/My%20Pictures/mohsen.jpg"
width="480" height="640"></a></p>

</body>

</html>';
//$text='<a href="http://www.google.com/">gfsdfgsdgdsfgsdgsfd</a> <a
href="http://www.orkut.com/">';

preg_match_all('/(<a *href *=)(["\']*)(http:\/\/[^"=[color=blue]
>]*)(["\']*)(>)/',$text,$matches,PREG_PATTERN_ORDER);[/color]
print_r($matches);
?>
[/PHP]

it can find just one of two match string in text (<a
href="http://www.google.com/">). but after several tests, and after i put
two match strings in one line :
[PHP]
$text='<a href="http://www.google.com/">gfsdfgsdgdsfgsdgsfd</a> <a
href="http://www.orkut.com/">';
[/PHP]
it could find both of them! it think the reason of this problem is
multiline.
therefore i have a questoin. is regex functions in php can support
multiline texts?
many thanks
(sorry for my bad english)


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with regex multiline end of line checking aarbit@gmail.com answers 0 April 20th, 2007 08:55 PM
regex multiline modifier and windows line endings Allen answers 2 February 6th, 2006 11:05 PM
Regular Expression to Match Blank Characters outside Multiline Comments Laser Lu answers 1 November 17th, 2005 01:42 AM
Javascript RegEx problem Mr.Clean answers 2 July 23rd, 2005 06:32 PM