indefinite-article.js
indefinite-article.js copied to clipboard
Regex not anchored
This regex is not anchored:
if (word.match(/(?!FJO|[HLMNS]Y.|RY[EO]|SQU|(F[LR]?|[HL]|MN?|N|RH?|S[CHKLMNPTVW]?|X(YL)?)[AEIOU])[FHLMNRSX][A-Z]/)) {
return "an";
}
It looks to me like this was intended:
if (word.match(/^(?!FJO|[HLMNS]Y.|RY[EO]|SQU|(F[LR]?|[HL]|MN?|N|RH?|S[CHKLMNPTVW]?|X(YL)?)[AEIOU])[FHLMNRSX][A-Z]/)) {
return "an";
}
As it is, this matches "SR" in "GDSR applicant" and returns "an" for "an GDSR applicant".