java string截取两个字符串之间的值
import java.util.regex.Matcher; import java.util.regex.Pattern; public class GetTag { public static void main(String[] args){ String str = "abc<icon>def</icon>deftfh<icon>a</icon>"; Pattern p=Pattern.compile("<icon>(//w+)</icon>"); Matcher m=p.matcher(str); while(m.find()){ System.out.println(m.group(1)); } } }
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/19449.html