Syntactic Confectionery Delight | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hi
I read once that JS-regexes follow the standards of Perl4. Now I was quite surprised to learn that JS doesn't have a /s single-line modifier to let '.' also match on linebreaks like \n. As a compensation JS offers to use [^] to match everything (the negation of nothing is everything).
I like the concept and was wondering if there is any equivalent in Perl ... Here [^] is a syntax error because at this position Perl magically expects ']' to be part of the negated char-class and still expects another closing ']'. The closest that I was able to find was (?:.|\n)
Any other suggestions?
Cheers Rolf
UpdateAnother option is to use single-line locally: (see perlrecharclass)
not shorter but cleaner! In reply to Regex: Char-class equivalent for [^] by LanX
|
|