public class Main { public static void main(String args[]) { String str = "10.11.90.1 asedfa 1.1.1.1"; List list = new ArrayList(); Pattern pattern = Pattern.compile("[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}"); Matcher matcher
直接上函数吧 不废话 function replacestring(oldstr,newstr,text) { var exp = new RegExp(oldstr,'g'); var c=text.replace(exp,newstr); return c; } var oldstr='world'; var newstr='cccc'; var text='Hello world, Hello world'; var aa= replacestring(oldstr,newstr,tex