![](/img/trans.png)
[英]How to remove all special Characters from a string except - . and space
[英]How to strip all characters from a string except for numbers, space and +
如何去除字符串中除數字,空格和+之外的所有字符? 正則表達式是什么?
我想用
String regex = ???
String string = previousString.replaceAll(regex, "");
但我不知道如何生成僅保留0-9,空格和+的正則表達式
regex = "[^\\d\\s\\+]"
^
:不,否定d
:數字s
:空間+
:您知道:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.