Re: multiline regex
| From: | mark | Date: | Wed, 11 Dec 2002 19:26:11 +0000 |
| Subject: | Re: multiline regex | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127876@lists.php.net to get a copy of this message | ||
I know I have to use pattern modifiers, but thats what Im saying its spewing
errors when I try to implement it.
I have been trying to fix it, but Im just lost.
"Bahwi" <bahwi@josephguhlin.com> wrote in message
news:3DF78D7D.9010203@josephguhlin.com...
> Over here will help:
> http://www.php.net/manual/en/ref.pcre.php
> http://www.php.net/manual/en/pcre.pattern.modifiers.php
>
> (From the second page:
>
> /m/ (PCRE_MULTILINE)
>
> By default, PCRE treats the subject string as consisting of a single
> "line" of characters (even if it actually contains several
> newlines). The "start of line" metacharacter (^) matches only at the
> start of the string, while the "end of line" metacharacter ($)
> matches only at the end of the string, or before a terminating
> newline (unless /D/ modifier is set). This is the same as Perl.
>
> When this modifier is set, the "start of line" and "end of line"
> constructs match immediately following or immediately before any
> newline in the subject string, respectively, as well as at the very
> start and end. This is equivalent to Perl's /m modifier. If there
> are no "\n" characters in a subject string, or no occurrences of ^
> or $ in a pattern, setting this modifier has no effect.
>
> No, I'm not posting this angrily, but sometimes it's easier to answer a
> question via cut and paste than writing up an answer yourself. =) I'm
> lazily helpful!
>
> --Joseph Guhlin - http://www.josephguhlin.com/
> Was I helpful? Let others know:
> http://svcs.affero.net/rm.php?r=bahwi
>
>