benjohn
3/12/2006 11:27:00 AM
Stefan Mahlitz said:
> benjohn@fysh.org wrote:
>
>> I was playing with regexp yesterday, and wanted to have a pattern
>> match
>> over multiple lines, but couldn't see how that is done (A friend
>> wanted a
>> simple way of stripping out c comments, and they can over multiple
>> lines,
>> of course). Could someone give me a hint on that?
>>
>
> You can use
>
> /myregexp/m
>
> but I'm not sure where this is documented.
>
Which is exactly what I was after, thanks.
The list of characters that you can slap on to the end are (cribbed from
the Nutshell):
i => case-insensitive
o => substitute only once.
x => ignores whitespace so that you can put comments in to a regex.
m => matches over multiple lines - newlines are treated as any other
character.
And you can use combinations too, if you fancy.
Cheers Stefan,
Benjohn