How to remove all alphabetical characters from a string usign a regular expression in java/android?
val = val.replaceAll("/A/z","");
How to remove all alphabetical characters from a string usign a regular expression in java/android?
val = val.replaceAll("/A/z","");
Try this:
replaceAll("[a-z]", "");
Also have a look here:
Have a look into Unicode properites:
\p{L}
any kind of letter from any language
So your regex would look like this
val = val.replaceAll("\\p{L}+","");
To remove also combined letters use a character class and add \p{M}
\p{M}
a character intended to be combined with another character (e.g. accents, umlauts, enclosing boxes, etc.)
Then you end here:
val = val.replaceAll("[\\p{L}\\p{M}]+","");
This will remove all alphabetical characters
String text = "gdgddfgdfh123.0114cc";
String numOnly = text.replaceAll("\\p{Alpha}","");