3 ms·
SuperExpressive() .anythingButString('aeiou') .toRegex(); // -> /(?:[^a][^e][^i][^o][^u])/ There's got to be a better way to express that in Regex,
by cmpb 6y ago
SuperExpressive()
.anythingButString('aeiou')
.toRegex();
// ->
/(?:[^a][^e][^i][^o][^u])/
There's got to be a better way to express that in Regex, right?
- celeritascelery 6y agoNot without look-ahead/look-behind
- hvdijk 6y agoWow, what a horribly named function for a library that aims to make regular expressions more readable. The name very strongly suggests it should match anything but the string aeiou, so that it would match for instance the string a, but that is not what it does at all.
- DFHippie 6y agoHmmm.... 'beiou' isn't 'aeiou', but it isn't matched by that pattern. It seems like you need /(?:[^a]....|.[^e]...|..[^i]..|...[^o].|....[^u])/.