fork(1) download
  1. import java.util.*;
  2. import java.util.regex.*;
  3. import java.lang.*;
  4. import java.io.*;
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. String text = "Hello {{ some | value }}, this is what i tried {{ another | value }}";
  10. text = text.replaceAll("\\{\\{\\s*((?:(?!\\{\\{)[^|])*?)\\s*\\|\\s*(.*?)\\s*\\}\\}", "$1");
  11. System.out.println(text);
  12. }
  13. }
Success #stdin #stdout 0.08s 27984KB
stdin
Standard input is empty
stdout
Hello some, this is what i tried another