2013-12-11 273 views

回答

1

如果我得到它正确的正则表达式“我很有趣只有该文件的ID号”将是:[0-9]+或与Java预定义字符类; [\d]+

+0

https://www.debuggex.com/r/A1YEMH-EHyjdeUUM – Kiwy

+0

https://ideone.com/c3Ty7T – user987339

+0

在Java'\\ d +'中。 – OGHaza

0

试试这个。

String str = "file!^#123456"; 
System.out.println(str.replaceAll("\\D+","")); 
0

你可以在它去用串在它自己的:

String s = "file!^#123456"; 
    System.out.println(s.substring(s.indexOf("#") + 1, s.length()));