I want to select the character from matched text, but not sure how to do the lookbehind select.
For example, I want to select out the "a" from the "apple" only, and not from "pineapple", I used the regex below:
/\ba(?=pple)/gi
I want to select the "e" from "apple" only, but not sure how to write the regex. The below regex will return the whole word "apple", instead of "e" only.
/\b(appl)e/gi
How can I select out the "e" or any other character such as "l" ?
var text = "apple pineapple aeroplane";
var lookahead = /\ba(?=pple)/gi;
alert(text.match(lookahead));
var lookbehind = /\b(appl)e/gi;
alert(text.match(lookbehind));
ais alerted./\b(a)pple/likewise:/\bappl(e)/if you what's the purpose ofMatching Group ()Selecting the characters like you do makes me wander what you're actually up to.matched[2], as I need to have a long regex, and this is part of it only.