What's the best way to match any letter from any language? That's what I'm doing:
let str1 = "aabb";
console.log( str1.replace( /\w/gu, "$&|") ); //→ a|a|b|b|
let str2 = "aābḇ";
console.log( str2.replace( /\w/gu, "$&|") ); //→ a|Äb|ḇ
I want to have something like sed
and grep
:
$ echo aābḇ | sed 's/\w/&|/g'
a|ā|b|ḇ|
$ echo "ʔ.ā^ḫ&" | grep -o '\w'
ʔ
ā
ḫ
The same question about unicode \b
.