When i write a regular expression like:
m = /(s+).*?(l)[^l]*?(o+)/.exec( "this is hello to you" )
console.log( m );
I get a match object containing the following:
{
0: "s is hello",
1: "s",
2: "l",
3: "o",
index: 3,
input: "this is hello to you"
}
I know the index of the entire match from the 'index' property, but i also need to know the start and end of the groups matched. Using a simple search won't work. In this example it will find the first 'l' instead of the one found in the group.
Is there any way to get the offset of a matched group?