import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "<p>(\\w|\"|').+<\\/p>";
final String string = "<p>坐在马车上的叶天,通过窗户看向远处雄伟的天炎城,一时间不由苦笑。</p>\n"
+ "<p>ye Tian, sitting in the carriage</p>\n"
+ "<p>至于原因,小糯米跟纪小小根本受不了天炎城那一百多度的高温,此时已经热的快要中暑了。</p>\n"
+ "<p>As for the reason, Xiaomi and Ji Xiaoxiao couldn't stand has a heatstroke.</p>\n"
+ "<p>小金吼倒是没事,趴在叶天脚下睡的深沉。</p>\n"
+ "<p>Xiao Jin’s squatting is fine, and he is sleeping deep at the foot of Ye Tian.</p>\n"
+ "<p>“少爷,我受不了啦!”小糯米眼见马车每前行一步,温度就会上升几度,连向叶天求救。</p>\n"
+ "<p>\"\"Young master, I can't stand it!\"\" .</p>";
final String subst = "";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
// The substituted value will be contained in the result variable
final String result = matcher.replaceAll(subst);
System.out.println("Substitution result: " + result);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html