String filter = "TU QUERY"; String filter1 = filter.remplaceAll("[el viejo valor]","el nuevo valor"); filter = filter1;