我确实有一些像......这样的随机消息。
Please conform to regex ^[0-9]*$ with a maximum length of 13
Please conform to regex ^[a-z]*$
Please conform to regex (?:\\d*\\.)?\\d+ with a maximum length of 999
(and many more...)
如何用
替换这些正则表达式字符串'Only number' when '^[0-9]*$' appears
'Only lower case' when '^[a-z]*$'appears
(and so on... ?)
答案 0 :(得分:0)
我们说你有String str = "...";
。您可以使用以下String
类方法:
if(str.contains("somethingYouWantReplaced")
str.replace("somethingYouWantReplaced", "newValue");
另外,请查看: