Here you can find the source of getMatcherForXmlTags(String xml, String tag)
public static Matcher getMatcherForXmlTags(String xml, String tag)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static Matcher getMatcherForXmlTags(String xml, String tag) { String regexCode = "(?<=<" + tag + ">)(.*?)(?=</" + tag + ">)"; Matcher m = regexGetMatcherForPattern(xml, regexCode); return m; }// ww w .j a v a 2 s.com public static Matcher regexGetMatcherForPattern(String string, String pattern) { if (string == null || pattern == null) { return null; } /** * strip newline characters because it doesn't work well with this. */ // string = string.replace("\n", ""); Pattern p = Pattern.compile(pattern, Pattern.DOTALL | Pattern.MULTILINE); Matcher m = p.matcher(string); return m; } }