Answers for "extract the desired group, as follows:"

0

extract the desired group, as follows:

final Pattern pattern = Pattern.compile("<tag>(.+?)</tag>", Pattern.DOTALL);
final Matcher matcher = pattern.matcher("<tag>String I want to extract</tag>");
matcher.find();
System.out.println(matcher.group(1)); // Prints String I want to extract
Posted by: Guest on October-07-2021

Code answers related to "extract the desired group, as follows:"

Browse Popular Code Answers by Language