fork download
  1. import java.util.*;
  2. import java.util.regex.*;
  3.  
  4. class Test
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. String strings[] = {"choryangStn_110_220114_일_0.sbm",
  9. "choryangStn_110_220114_이_0.sbm",
  10. "choryangStn_110_220114_삼_0.sbm"
  11. };
  12. String regex = "(?U)^.*_(\\w+)_\\d+\\.\\w+$";
  13. for(String text : strings)
  14. {
  15. System.out.println("'" + text + "' => '" + text.replaceFirst(regex, "$1") + "'");
  16. }
  17. }
  18. }
Success #stdin #stdout 0.17s 57360KB
stdin
Standard input is empty
stdout
'choryangStn_110_220114_일_0.sbm' => '일'
'choryangStn_110_220114_이_0.sbm' => '이'
'choryangStn_110_220114_삼_0.sbm' => '삼'