Sto cercando di sostituire un valore stringa java come segue. sotto il codice non funziona.Regex utilizzando Java String.replaceAll
cleanInst.replaceAll("[<i>]", "");
cleanInst.replaceAll("[</i>]", "");
cleanInst.replaceAll("[//]", "/");
cleanInst.replaceAll("[\bPhysics Dept.\b]", "Physics Department");
cleanInst.replaceAll("[\b/n\b]", ";");
cleanInst.replaceAll("[\bDEPT\b]", "The Department");
cleanInst.replaceAll("[\bDEPT.\b]", "The Department");
cleanInst.replaceAll("[\bThe Dept.\b]", "The Department");
cleanInst.replaceAll("[\bthe dept.\b]", "The Department");
cleanInst.replaceAll("[\bThe Dept\b]", "The Department");
cleanInst.replaceAll("[\bthe dept\b]", "The Department");
cleanInst.replaceAll("[\bDept.\b]", "The Department");
cleanInst.replaceAll("[\bdept.\b]", "The Department");
cleanInst.replaceAll("[\bdept\b]", "The Department");
Qual è il modo più semplice per ottenere la sostituzione di cui sopra?
cosa intendi per non lavoro? – stinepike
Rimuovi le parentesi quadre ('[' e ']'). Questi sono per classi di personaggi. Se qualcos'altro non funziona, dovrai essere più specifico. – iamnotmaynard
Sei consapevole di ciò che una classe di caratteri è in un'espressione regolare? http://regex.info – fge