ECMAScript, as well as all other flavors supported by the std::regex
, does not support Unicode properties (Unicode category classes).
As a workaround, use Boost library in C++.
In Boost, declare the regex as follows:
boost::wregex reg(L"^\\p{L}+$");
Note that ^\p{L}+$
matches 1+ letter strings only.
In ECMAScript used in JavaScript in modern browsers, you can use
var str = "bębnić";
var regex = /^\p{L}+$/u;
console.log(regex.test(str));
An XRegExp based solution in JavaScript for older browsers (like Safari):
var str = "bębnić";
regex = XRegExp('^\\p{L}+$');
console.log(regex.test(str));
<script src="https://cdnjs.cloudflare.com/ajax/libs/xregexp/2.0.0/xregexp-all-min.js"></script>