in reply to RegEx: Why is [.] not a valid character class?

"Why is '\n' handled in a special way?" Because \n IS special, especially in the past when text was often line-oriented. Simply add /s (it has no other side effects) or use (?:.|\n). In Perl6, /s is on my default.

Replies are listed 'Best First'.
Re^2: RegEx: Why is [.] not a valid character class?
by ihb (Deacon) on Nov 18, 2004 at 02:49 UTC

    (?:.|\n) is unnecessary slow due to the alternation. (?s:.) doesn't suffer from that.

    ihb

    See perltoc if you don't know which perldoc to read!
    Read argumentation in its context!