Discussion:
[ jEdit-users ] multi-line reg-exp flag?
Saimon Moore
24 years ago
Permalink
I'm trying to match block comments ie /* .... */ over multiple-lines using
the regexp search feature, but I can't seem to get the multiline flag set.
I've tried

/(/\*)(.){0,}(\*/)/m
/(/\*)(.){0,}(\*/)/s
/(/\*)(.){0,}(\*/)/$*

Any thought's???

Saimon
Alan Moore
24 years ago
Permalink
Your problem is that you're trying to use a dot (.) to match
newlines, which doesn't work whether you're in multiline mode
or not. There's an execution flag that lets dot match newlines,
but you can't set it from within the search dialog. Instead,
use something like:

/\*[\s\S]*?\*/

The '[\s\S]' will match anything _including_ a newline. If you
wanted to capture the comment, you would use:

/\*([\s\S]*?)\*/

BTW, multiline mode just tells the matcher that '^' and '$' should
match at the beginning and end, respectively, of each line. Regex
searches in jEdit's search dialog are always in multiline mode.

--Alan
Post by Saimon Moore
I'm trying to match block comments ie /* .... */ over multiple-lines using
the regexp search feature, but I can't seem to get the multiline flag set.
I've tried
/(/\*)(.){0,}(\*/)/m
/(/\*)(.){0,}(\*/)/s
/(/\*)(.){0,}(\*/)/$*
Any thought's???
Saimon Moore
24 years ago
Permalink
...
Thanks a lot. It works a treat.

Saimon

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Loading...