fork(29) download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. import java.util.regex.*;
  5.  
  6. class Main
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. StringBuilder sb = new StringBuilder();
  11. sb.append("This works with StringBuffers");
  12. Pattern p = Pattern.compile("\\Buffer\\B");
  13. Matcher m = p.matcher(sb);
  14. System.out.println(m.replaceAll("uilder"));
  15. }
  16. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
This works with StringBuilders