NYCPHP Meetup

NYPHP.org

[nycphp-talk] regexp: feeling stupid

David Sklar sklar at sklar.com
Wed Mar 17 14:40:58 EST 2004


Yes, you're correct. Good catch! /s (or '}s' in this case) is required 
to make "." match newlines as well as any other character.

David

David Mintz wrote:

> I'm no guru so maybe I missed something but -- it looks like the regex
> assumes all the stuff will be on a single line. If you want to allow the
> possibility that there are newlines between <sup> and </sup>, add the s
> modifier.
> 
> Right?
> 
> On Wed, 17 Mar 2004, David Sklar wrote:
> 
> 
>>The regular expression '|<sup
>>class="gt_article_footnote">([^</sup>]+)</sup>|'
>>
>>Says
>>
>>"match the literal text '<sup class="gt_article_footnote">' then one or
>>more characters that aren't <, /, s, u, p, or >, then the literal text
>>'</sup>'"
>>
>>You want
>>
>>{<sup class="gt_article_footnote">(.+?)</sup>}






More information about the talk mailing list