simple singularities

javascript multiline match

Filed under: javascript, programming — fri13th July 24, 2007 @ 12:04 pm

javascripts’s . (dot) doesn’t match line boundary. so if you want match all strings in a multiline string, you should use [^]* instead normal .*  multiline flag ‘m’ is useless in this case.

it’s a small tip, but perl programmer like me doesn’t understand this behavior.. gee..

below is regex test page, i found today from ajaxian. cool,  but you have to be be cautious. it easily sutdowns the browser, when you testing this syntax /.*/g or so.
http://erik.eae.net/playground/regexp/regexp.html

P.S. unfortunately [^] doesn’t work in IE.. use [\s\S] instead, it works very fine..

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment