1
我想用以下替換replaceAll()
正則表達式:的replaceAll在Java
#one# -> <element name="one">
#two# -> <element name="two">
等...
我需要什麼樣的正則表達式?
這裏是一個天真的嘗試:
replaceAll("#[\w]#", "<element name=\"[?1]\"");
// my hope is that I can remember a value somehow (`[\w]`) and use it for the substitution ([?1])
// which is, written like this, a nonsense