Is there a way to set the u
flag and thus enable unicode regex patterns?
I need to match names like Straßer
, Müller
, Adèle
, Yiğit
.
/\p{L}+/u
or new RegExp('\\p{L}+', 'u')
would work in my case if I could use plain JS in JSON schema.
The specification says
6.3.3. pattern
The value of this keyword MUST be a string. This string SHOULD be a valid regular expression, according to the ECMA-262 regular expression dialect.
I found this: How to match a Unicode letter with a JSON Schema pattern (regular expression) . The result is too obfuscating. JavaScript/ECMA Script can handle \p{L}
as expected if the u
flag is set.