fork(45) download
  1. class Ideone {
  2. static void main(String[] args) {
  3. def name = "{someInformation}"
  4. def s = "0/$name|2/{moreInformation}|3/$name"
  5. println(s) // => 0/{someInformation}|2/{moreInformation}|3/{someInformation}
  6. def pat = "\\|*\\d+/${java.util.regex.Pattern.quote(name)}\\|*"
  7. println(pat)
  8. println(s.replaceAll(pat, ""))
  9. }
  10. }
  11.  
Success #stdin #stdout 0.85s 4456448KB
stdin
Standard input is empty
stdout
0/{someInformation}|2/{moreInformation}|3/{someInformation}
\|*\d+/\Q{someInformation}\E\|*
2/{moreInformation}