[support] preg_match failes where egrep and PERL succeed?

Dick Middleton dick at fouter.net
Thu Feb 4 08:25:53 UTC 2010


Luke wrote:
> (Solved!  See below for details.)

> I've just figured it out.  The difference between the greps and 
> PCRE, is that in the greps, the data is taken on a line by line basis. 
> So, ^ matches the start of a line.
> PCRE is not treating newline specially, so ^ and $ apply to the beginning 
> and end of the entire pattern space.

You could fiddle about with the options:

# m Multiline mode - ^ and $ match internal lines
# s match as a Single line - . matches \n

c.f. perlreref

Dick



More information about the support mailing list