Get all digits from a string : String Operation « Regular Expressions « Java
- Java
- Regular Expressions
- String Operation
Get all digits from a string
public class Main {
public static void main(String[] argv) throws Exception {
System.out.println("abasdfasdf1 2wasdfasdf9_8asdfasdfz asdfasdfyx7".replaceAll("\\D", ""));
}
}
Related examples in the same category