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".

-- 
Greg Marr
[EMAIL PROTECTED]
"We thought you were dead."
"I was, but I'm better now." - Sheridan, "The Summoning"

Reply via email to