[nycphp-talk] regexp: feeling stupid
Marc Antony Vose
suzerain at suzerain.com
Wed Mar 17 15:01:07 EST 2004
hey davids:
many thanks. i was trying in my head to create a match for the
beginning of the tag, then anything that is not "</sup>", and then
</sup>.
many times, like now, i find that my strategy is wrong with pattern matching.
cheers,
marc
>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>}
>
>
>
>_______________________________________________
>talk mailing list
>talk at lists.nyphp.org
>http://lists.nyphp.org/mailman/listinfo/talk
More information about the talk
mailing list