Close, but not quite -- the /m modifier turns on multiline matching
-- allowing ^ and $ to match newlines embedded within the string.

I think you're thinking of the /s modifier, which allows '.' to
match newline chars like any other.


On Wed, 20 Feb 2002, Greg Marr wrote:

> At 12:03 PM 02/20/2002, Peter R. Wood wrote:
> > > So, I think you really want:
> > >
> > >   if ( $query =~ m#/\*\+\s+(.+?)\s+\*/# )
> >
> >Ok, so let me make sure I am reading your pattern correctly:
> >
> >(.+?) > followed by one or more non-newline characters, which will
> >match up
> >to the first occurrance of the next character after the ?, the
> >contents of
> >the match being placed in $1
>
> Not exactly.  Just .+, without the ?, will match the largest number,
> greater than zero, of non-newline characters (assuming you're not
> using the m modifier) that still causes the rest of the pattern to
> match.  With the ?, .+?, it will match the smallest number, greater
> than zero, of non-newline characters that still causes the rest of
> the pattern to match.
>
> Using this string:
> /*+ foo bar baz *//*+ foo bar baz */
> Without the ?, it would match "foo bar baz *//*+ foo bar baz".  With
> the ?, it would match "foo bar baz".
>
>

-- 
Steve Reppucci                                       [EMAIL PROTECTED] |
Logical Choice Software                          http://logsoft.com/ |
=-=-=-=-=-=-=-=-=-=-  My God!  What have I done?  -=-=-=-=-=-=-=-=-=-=

Reply via email to