📌  相关文章
📜  用正则表达式查找开头和结尾的元音 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:04:13.644000             🧑  作者: Mango

代码示例1
//  ^ => first item matches:
// () => stores matching value captured within
// [aeiou] => matches any of the characters in the brackets
// . => matches any character:
// + => for 1 or more occurrances (this ensures str length > 3)
// \1 => matches to previously stored match. 
    // \2 looks for matched item stored 2 instances ago 
    // \3 looks for matched item stored 3 ago, etc

//  $ ensures that matched item is at end of the sequence

let re = /^([aeiou]).*\1$/i;

return re;

}