On 13.10.2011 8:38, Andrei Alexandrescu wrote:
On 10/12/11 9:50 PM, Jesse Phillips wrote:
On Wed, 12 Oct 2011 23:35:49 +0000, kennytm wrote:

Most regex flavors don't match '\n' by default unless you supply the "s"
flag -- including ECMAScript (well it doesn't even provide the "s" flag
to allow '.' to match all characters).

Really? Sense when? I didn't know there was any that didn't match \n. If
you want to match everything not a new line [^\n].

Kenny's right.

http://www.regular-expressions.info/dot.html

Engines have special options for multiline.


The funny thing is that multiline mode affects only ^ & $ anchors. And single line mode affects only . matches \r and \n rule. So it's entirely possible to use both at the same time.

But anyway I guess I have to bite the bullet: add 's' option and introduce classic semantics by default.

BTW in unicode end of line is much more then just \r or \n and among other things includes "unbreakable" two codepoint sequence '\r\n'. I wonder if any engine matches . in the middle of \r\n or do they detect stop on any other end-of-line characters.


--
Dmitry Olshansky

Reply via email to