So I know this question may appear similar to other questions out there regarding regex and such. I believe mine is unique because I'm using java to parse some javascript, which can contain brackets within brackets for anonymous functions etc. Consider the following as an example:
describe('a jasmine describe', function (){
it('login', function(){
//some function stuff
});
it('another it statement', function() {
//some additional stuff
});
});
What I ultimately want is:
Group 1: "a jasmine describe"
Group 2: all of the content between open/close brackets of the describe
I believe I have the regex to get the Group 1 I'm looking for which is:
Pattern r = Pattern.compile("(?:describe\\s*\\(\\s*')(.*?)(?=')", Pattern.CASE_INSENSITIVE);
But I have no idea how to get the contents between the open/close of the specific describe bracket.