i have the following regex that allows only alphabets :
/[a-zA-Z]+/
a = "abcDF"
if (a.match(/[a-zA-Z]+/) == a){
//Match
}else{
//No Match
}
How can I do this using p{L} (universal – any language like german, english etc.. )
What I tried :
a.match(/[p{l}]+/)
a.match(/[\p{l}]+/)
a.match(/p{l}/)
a.match(/\p{l}/)
but all returned null for the letter a = “aB”
Starting with ECMAScript 2018, JavaScript finally supports Unicode property escapes natively.
For older versions, you either need to define all the relevant Unicode ranges yourself. Or you can use Steven Levithan’s
XRegExppackage with Unicode add-ons and utilize its Unicode property shortcuts: