Code is something like this.
String regx = "my reg X";
String input = "here put your input string";
Pattern pattern = Pattern.compile(regx); Matcher matcher = pattern.matcher(input);Now you have got your parsing engine ready. you have to just search now.while (matcher.find()) { System.out.println("Match found"); System.out.println("Start" + matcher.start());
System.out.println("Start" + matcher.end());
}Now stop using StringTokenizer and all other complex logics to parse something.
No comments:
Post a Comment