ray*_*owe 8 java regex android
我在Android中有一个字符串.我想用一些html包装4个或更多连续数字的所有实例.我想这将使用正则表达式来完成,但我很难获得最基本的正则表达式.
有人可以帮我弄这个吗?
我想改变:
var input = "My phone is 1234567890 and my office is 7894561230";
Run Code Online (Sandbox Code Playgroud)
至
var output = "My phone is <u>1234567890</u> and my office is <u>7894561230</u>";
Run Code Online (Sandbox Code Playgroud)
Kep*_*pil 35
这样做:
String input = "My phone is 1234567890 and my office is 7894561230";
String regex = "\\d{4,}";
String output = input.replaceAll(regex, "<u>$0</u>");
System.out.println(output);
Run Code Online (Sandbox Code Playgroud)