[tech] php preg_match_all help?
James Devenish
devenish at ucc.gu.uwa.edu.au
Tue Jan 22 12:49:17 WST 2002
On Tue, Jan 22, 2002 at 12:38:09PM +0800, Tiang Cheng wrote:
> hi,
> I need help deciphering this example using preg_match_all()
> $string = <br>example: </b><div align=left>this is a test</div>";
>
> preg_match_all("|<[^>]+>(.*)</{^>]+>|U", $string, $output,
> PREG_PATTERN_ORDER);
>
> i don't understand the first argument. what is it, and how does that
> work?
You mean, haven't heard of regular expressions at all,
or you specifically aren't familiar with the perl syntax?
Do you know what preg_match_all does?
Or do you just mean that the first argument gives you an
error (it doesn't appear to have matching brackets). Also,
if that particular expression doesn't work, you should check
in the PHP documentation about whether PHP can understand
the U flag that has been given with the syntax "|...|U"
(where the pipe characters delimit the regex and are not
part of the matched sequence).
There's really heaps of information about regular expressions
all over UNIX derivatives and on the Internet, of course.
Have you checked the PHP documentation? They seem to have a
section devoted to the syntax:
<http://www.php.net/manual/en/pcre.pattern.syntax.php>
> any help at all would be greatly appreciated. :O)
> Tiang
More information about the tech
mailing list