in reply to Modern best practices for multilingual regexp alphabetical character matching?
The data I'm working with will all be UTF-8, if that makes a difference.That makes a huge difference. \w will match just the 26 letters (both cases), 10 digits and the underscore if your strings aren't in UTF-8 format (unless you have a locale). Otherwise, it will match anything that's a Unicode letter, Unicode digit or underscore.
However, since there's this dependency on whether the string you match against is in UTF-8 format or not, I'd shy away from UTF-8. Instead, use \p{L} which will match any character the Unicode standard says is a letter. So, you'd get:
if (/^(\p{L}+)$/) {say "found [$1]"}
|
---|
In Section
Seekers of Perl Wisdom