The single line regex modifier is not available for Javascript

To prevent it replace your . by [\s\S] :

start(.*?)end

become

start([\s\S]*?)end

I had trouble with this syntax :

var myregExp = new RegExp ("start([\s\S]*?)end", "g");

Instead I used that way without trouble :

var myregExp = /start([\s\S]*?)end/g;

Source : http://fire-studios.com/blog/2008/overview-of-javascript-regex


Published 10th Nov 2011 // #javascript




comments powered by Disqus