Showing posts with label regular expression. Show all posts
Showing posts with label regular expression. Show all posts

Thursday, July 5, 2018

regular expression 사용 예제

오랫만에 패턴 매칭해서 결과값 구하는것 찾음.
regular expression은 내가 짠거는 쉬운데 남이 짠거는 잘 안읽힘. ㅠ


Pattern p = Pattern.compile("(([a-zA-Z][0-9][0-9]?)\\s*[\\/]\\s*.{3}\\s*[\\/]\\s*)");Matcher m = p.matcher(line); while(m.find())

T10 / name / AB12345

Tuesday, November 1, 2016

regular expression remove font-size

recent I made regular expression for removing font-size tag in style attribute

this is what I made

        private static String removeFontSizeFromStyle(String styleContent) {
  String fontPattern = "[fF][oO][nN][tT]-[sS][iI][zZ][eE]\\s*:\\s*[0-9.]+[a-zA-Z%]*\\s*+;?";

  return styleContent.replaceAll(fontPattern, "");
 }