Posts

Showing posts with the label 정규식

java regular expression(정규표현식)

study -  http://zvon.org/comp/r/tut-Regexp.html#Pages~Page_3 -  http://regexone.com/ -------------- -------------- -------------- -------------- -------------- package testjava; import java.util.regex.Matcher; import java.util.regex.Pattern; public class TPattern { public static void main(String[] args){ String regularExpression = "^who"; String source =  "who is who"; String originalSource = source; Matcher m = Pattern.compile(regularExpression).matcher(source); source = source.replaceAll(regularExpression, "####"); System.out.println("regx\t\t:"+regularExpression); System.out.println("original\t:"+originalSource); System.out.println("source\t\t:"+source); System.out.println("find\t\t:"+m.find()); System.out.println("matches\t\t:"+m.matches()); } } -------------- -------------- -------------- -------------- -------------- -------------- -------------- result : regx :^who ori...