String s1 = "<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream=\"http://etherx.jabber.org/streams\" xmlns=\"jabber:server\" from=\"imconnector.rcs.com\" id=\"d825dc88\" xml:lang=\"en\" version=\"1.0\"><stream:features></stream:features>";
要检验包含id="1d3d3t5d" 的字符
String s = "(\\<)*(\\s*)(:*)(/*)(\\>*)('*)(.*)(=*)(-*)(\\?*)(\\w*)(\\s*)(id=\"\\w{8}\")(\\s*)(\\w*)(\\<)*(\\s*)(:*)(/*)(\\>*)('*)(.*)(=*)(-*)(\\?*)";
替换id="2k39djj3"的字符
s1.replaceAll("(id=\"\\w{8}\")", "xxx");
要检验包含id="1d3d3t5d" 的字符
String s = "(\\<)*(\\s*)(:*)(/*)(\\>*)('*)(.*)(=*)(-*)(\\?*)(\\w*)(\\s*)(id=\"\\w{8}\")(\\s*)(\\w*)(\\<)*(\\s*)(:*)(/*)(\\>*)('*)(.*)(=*)(-*)(\\?*)";
替换id="2k39djj3"的字符
s1.replaceAll("(id=\"\\w{8}\")", "xxx");