UPDATED
I need some help from you to defeat the regexp! I'm getting the external CSS file in a form of AJAX response like this:
$.when($.get("style.css")).done(function(response) {
var myCSS = response;
var patt = new RegExp("#mydiv(.*?)}","g");
var match = myCSS.match(patt);
alert(match);
}
What I'm trying to achieve here is I want to get everything from #mydiv to the last closing bracket }, but for some reason alert(match) returns me null.
The most annoying thing is when I change the pattern to:
var patt = new RegExp("#mydiv(.*?){","g"); // <-- Changed } to {
alert(match) returns me what is supposed to be returned --> #mydiv .mylink {
Or when I represent the same CSS in a form of a simple string like this:
$.when($.get("style.css")).done(function(response) {
var myCSS = "The same style.css but copy-pasted here";
var patt = new RegExp("#mydiv(.*?)}","g");
var match = myCSS.match(patt);
alert(match);
}
Works with my initial pattern as expected. Any thoughts what am I missing here?