I am trying to cut a string to leave the remaining words. For anything using the latin alphabet, I can easily deal with it with
str = str.replace(/\W/g, '').replace(/[0-9]/g, '');
(I guess I probably don't need both replace
s, but I'm very new to regular expressions and not sure what I'm doing)
However, it also supplants foreign characters such as Chinese or Arabic.
How do I write a function for this?
strOne = "test!(Β£)98* string"; strTwo = "δ½ ε₯½οΌ325!# δΈη"; cleanUp (strOne); // Output: "test string" cleanUp (strTwo); // Output: "ζ¨ε₯½ δΈη"
(In case someone wonders, Chinese is my "hello world" through an online translator)
In the library note, I do not know if this value matters, but I use dojo and would like to avoid jquery if possible.
source share