i 90% there regular expression appreciate in finalizing it.
i start following string.
string toiletder= "toilet, bog, public convenience"; //formated code.
and need become "({bog}|{toilet}|{public convenience})"
my regex far is.
toiletder.replaceall("(\\p{alpha}+)", "{$1}|").replace(",", "") it produces following
"{toilet}| {bog}| {public}| {convenience}|" i want words surrounded in new set of {} when comma reached in string , not new word how works.
wouldn't
string string = "({" + toiletder.replaceall(",\\s*","}|{") + "})" be easier?
Comments
Post a Comment