我想要實現在Java中Java的特殊字符的正則表達式
String[] paramsToReplace = {"email", "address", "phone"};
//input URL string
String ip = "http://www.google.com?name=bob&email=okATtk.com&address=NYC&phone=007";
//output URL string
String op = "http://www.google.com?name=bob&email=&address=&phone=";
URL中使用正則表達式以下可以包含特殊字符,如%
如下這將返回不正確的輸出:http://www.google.com?name=bob&email=& – user1093296
@ user1093296我不t看到任何不正確的輸入。你能指定嗎?在我的測試中,我得到了'http://www.google.com?name = bob&email =&address =&phone =',就像您在文章中所要求的一樣。 – Thomas
http://www.google.com?name=bob&email=& – user1093296