fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.Matcher;
  5. import java.util.regex.Pattern;
  6.  
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. final String regex = "^[^_]*_";
  12. final String string = "1.IND_FROM_ONE_TO_FIVE \n"
  13. + "2.IND_FROM_FIVE_TO_TEN \n"
  14. + "3.BS_FROM_ONE_TO_FIVE \n"
  15. + "4.BS_FROM_FIVE_TO_TEN \n"
  16. + "5.OP_FROM_ONE_TO_FIVE \n"
  17. + "6.OP_FROM_FIVE_TO_TEN";
  18. final String subst = "";
  19.  
  20. final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
  21. final Matcher matcher = pattern.matcher(string);
  22. final String result = matcher.replaceAll(subst);
  23.  
  24. System.out.println(result);
  25. }
  26. }
Success #stdin #stdout 0.06s 33536KB
stdin
Standard input is empty
stdout
FROM_ONE_TO_FIVE  
FROM_FIVE_TO_TEN  
FROM_ONE_TO_FIVE 
FROM_FIVE_TO_TEN   
FROM_ONE_TO_FIVE  
FROM_FIVE_TO_TEN