[pmwiki-users] How to do multiline regexps in PHP?

Patrick R. Michaud pmichaud at pobox.com
Tue Nov 1 14:18:58 CST 2005


On Tue, Nov 01, 2005 at 01:58:54PM -0500, Ryan Varick wrote:
> I'm working on RSS syndication for my PmWiki blog project
> (http://www.ryanvarick.com/Blog/Index), using RSSSimple as a base
> recipe.  I have the following regexp to extract post information:
> 
> $num_matches = preg_match_all("/\(:div\
> $blogdateFmt:\)\n(.*)\n\(:divend:\)\n(.*)/", $source, $match,
> PREG_SET_ORDER);
> 
> This is nearly what I want; only, it just returns the first paragraph.
>  I don't know what to tell PHP for it to ignore newlines.  I'm sure
> it's something simple.

Put /s at the end of the pattern.  See
http://us3.php.net/manual/en/reference.pcre.pattern.modifiers.php

Pm





More information about the pmwiki-users mailing list