JS XRegExp Replace all non characters
My objective is to replace all non letters/numbers in a string. All
occurences of - should not be replaced also. I have used for this the
XRegExp plugin but it seems I cannot find the magic solution :) I have
tryed like this :
var txt = "Ad ÑÒÈÍÃ (ALI) - Englishmen In New York";
var regex = new XRegExp('\\p{^N}\\p{^L}',"g");
var b = XRegExp.replace(txt, regex, "")
but the result is : AÑÒÈÍ(AL EnglishmeINeYork ... which is kind of weird
If I try to add also the condition for not removing the '-' character
leads to make the RegEx invalid.
No comments:
Post a Comment