Exemplos são os seguintes:
Public Static String Repdomain (fonte da string, domínio da string, elemento da string, string att) {string img = ""; Padrão p_image; Matcher m_image; String regex_img = "<" + elemento + "[^<>]*? // s" + att + "= ['/"]? (.*?) ['/"]? (// s.*?)?>"; p_image = padrony.compile (regex_img, padring.case_insensitive); m_image = p_image.matcher (origem); while (m_image.find ()) {img = m_image.group (); Matcher M = Pattern.compile ("href // s*= // s*/"? (.*?) (/"|> | // s+)"). Matcher (img); while (m.find ()) {string srcval = m.group (1); if (srcval.indexof ("/@inquantário")> = 0) {int idx = srcval.indexof ("/@inquant"); StringBuffer temp = new StringBuffer (); String dstval = temp.append (domain) .append (srcval.substring (idx+1)). Tostring (); fonte = fonte.Replace (srcval, dstval); }}} Retornar fonte; }O acima exposto é o conteúdo completo da expressão regular Java que o editor traz a você para obter o valor do atributo especificado e substituir a tag HTML especificada. Espero que todos possam apoiar mais wulin.com ~