3 ms·
SuperExpressive() .anythingButString('aeiou') .toRegex(); // -> /(?:[^a][^e][^i][^o][^u])/ This is incorrect. It will match "frank" (that w
by lifthrasiir 6y ago
SuperExpressive()
.anythingButString('aeiou')
.toRegex();
// ->
/(?:[^a][^e][^i][^o][^u])/
This is incorrect. It will match "frank" (that would be incorrect if the method is supposed to avoid all vowels) and won't match "aeiuo" (that would be incorrect if the method is supposed to accept anything but the exact string "aeiou"). Assuming the latter was intended, the correct behavior depends on the negation operator which is not natively supported in ECMAScript; simulation is possible (as negation of regular language is still regular) but at that point RegExp tends to be a bad solution.