import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "mailto:([^\\\"]+)";
final String string = "<p><a href=\"mailto:info@tartaytantas.es\"> info@tartaytantas.es</a></p>\n"
+ "<p>No cogemos pedidos por mail.</p>\n\n\n"
+ "<p></p>\n"
+ " </div><!-- .entry-content -->\n\n"
+ " <footer class=\"entry-footer\">\n"
+ " </footer><!-- .entry-footer -->\n"
+ " </div>\n"
+ "</article><!-- #post-## -->\n\n"
+ " </main><!-- #main -->\n"
+ " </div><!-- #primary -->\n\n"
+ "</div></div>\n"
+ " <footer id=\"colophon\" class=\"site-footer\" role=\"contentinfo\" itemscope=\"\" itemtype=\"http://schema.org/WPFooter\">\n\n"
+ " <div class=\"container\">\n\n"
+ " <div class=\"footer-t\">\n"
+ " <div class=\"row\">\n"
+ " <div class=\"three-cols\">\n"
+ " <div class=\"col\">\n"
+ " </div>\n"
+ " <div class=\"col center\">\n"
+ " <section class=\"widget widget_contact_form\">\n"
+ " </section>\n"
+ " </div>\n"
+ " <div class=\"col\">\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <p><a href=\"mailto:info@tartaytantas.es\"> info@tartaytantas.es</a></p>\n"
+ " <div class=\"site-info\">\n"
+ " <span>\n"
+ " ©2020 <a href=\"http://tartaytantas.es/\">Tartaytantas - Tartas y bizccochos a domicilio en Aravaca</a>. </span>\n"
+ " Bakes and Cakes | Desarrollado por <a href=\"https://rarathemes.com/\" rel=\"nofollow\" target=\"_blank\">\n"
+ " Rara Theme </a>\n"
+ " Funciona gracias a <a href=\"https://wordpress.org/\">WordPress.</a>\n\n"
+ " </div><!-- .site-info -->\n\n"
+ " </div>\n\n"
+ " </footer><!-- #colophon -->\n"
+ " <div class=\"overlay\"></div>\n"
+ " <a href=\"javascript:void(0);\" class=\"btn-top\"><span>Arriba</span></a>\n\n"
+ " </div><!-- #acc-content -->\n"
+ "</div><!-- #page -->\n\n"
+ "<script type=\"text/javascript\" src=\"https://secureservercdn.net/160.153.137.170/zm5.b57.myftpupload.com/wp-content/themes/bakes-and-cakes/js/owl.carousel.min.js\n"
+ "javascriptvue.jsEdit tags\n";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
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