I\'m trying to match the start and end character of a string to be the same vowel. My regex is working in most scenarios, but failing in others:
var re = /([aeio
Correct answer is already mentioned above, just for some more clarification:
regEx= /^([a,e,i,o,u])(.*)\1$/
Here, \1
is the backreference to match the same text again, you can reuse the same backreference more than once. Most regex flavors support up to 99 capturing groups and double-digit backreferences. So \99 is a valid backreference if your regex has 99 capturing groups.visit_for_detail