fork(1) download
  1. import java.util.regex.*;
  2. import java.util.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String input = "{\\rtlch\\fcs1 \\af39\\afs20 \\ltrch\\fcs0 \\fs20\\insrsid10175635\\charrsid8585274 \\hich\\af39\\dbch\\af31505\\loch\\f39 Build Job City:\\par \\hich\\af39\\dbch\\af31505\\loch\\f39 ^L\\hich\\af39\\dbch\\af31505\\loch\\f39 OT-CITY^}";
  11. String tagRegex = "\\^(.*?)\\^";
  12. Pattern tagRegexPattern = Pattern.compile(tagRegex, Pattern.DOTALL);
  13. Matcher tagRegexPatternMatcher = tagRegexPattern.matcher(input);
  14. while(tagRegexPatternMatcher.find()) { // work
  15. String tag = tagRegexPatternMatcher.group(1);
  16. String controlWordRegex = "\\b(?:\\\\[a-zA-Z]+(-?[0-9]+)? ?)+ \\b";
  17. System.out.println(tag.replaceAll(controlWordRegex, ""));
  18. }
  19. }
  20. }
Success #stdin #stdout 0.07s 3359744KB
stdin
Standard input is empty
stdout
LOT-CITY