import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "—</span> (.+?) <a.+?href=\\\"(.+?)\\\">CH(.+?)<.+?/>(.+?) <";
final String string = "\n"
+ "<!DOCTYPE html>\n"
+ "<html lang=\"en-US\">\n"
+ "<head>\n"
+ "<meta charset=\"UTF-8\">\n"
+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n"
+ "<title>HDSTREAMS.CLUB – Watch Soccer, NBA, NFL, Racing and Fighting Games Live</title>\n"
+ "<link rel='dns-prefetch' href='//fonts.googleapis.com' />\n"
+ "<link rel='dns-prefetch' href='//s.w.org' />\n"
+ "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"HDSTREAMS.CLUB » Feed\" href=\"http://hdstreams.club/feed/\" />\n"
+ "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"HDSTREAMS.CLUB » Comments Feed\" href=\"http://hdstreams.club/comments/feed/\" />\n"
+ " <script type=\"text/javascript\">\n"
+ " window._wpemojiSettings = {\"baseUrl\":\"https:\\/\\/s.w.org\\/images\\/core\\/emoji\\/12.0.0-1\\/72x72\\/\",\"ext\":\".png\",\"svgUrl\":\"https:\\/\\/s.w.org\\/images\\/core\\/emoji\\/12.0.0-1\\/svg\\/\",\"svgExt\":\".svg\",\"source\":{\"concatemoji\":\"http:\\/\\/hdstreams.club\\/wp-includes\\/js\\/wp-emoji-release.min.js?ver=5.3.2\"}};\n"
+ " !function(e,a,t){var r,n,o,i,p=a.createElement(\"canvas\"),s=p.getContext&&p.getContext(\"2d\");function c(e,t){var a=String.fromCharCode;s.clearRect(0,0,p.width,p.height),s.fillText(a.apply(this,e),0,0);var r=p.toDataURL();return s.clearRect(0,0,p.width,p.height),s.fillText(a.apply(this,t),0,0),r===p.toDataURL()}function l(e){if(!s||!s.fillText)return!1;switch(s.textBaseline=\"top\",s.font=\"600 32px Arial\",e){case\"flag\":return!c([127987,65039,8205,9895,65039],[127987,65039,8203,9895,65039])&&(!c([55356,56826,55356,56819],[55356,56826,8203,55356,56819])&&!c([55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447],[55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447]));case\"emoji\":return!c([55357,56424,55356,57342,8205,55358,56605,8205,55357,56424,55356,57340],[55357,56424,55356,57342,8203,55358,56605,8203,55357,56424,55356,57340])}return!1}function d(e){var t=a.createElement(\"script\");t.src=e,t.defer=t.type=\"text/javascript\",a.getElementsByTagName(\"head\")[0].appendChild(t)}for(i=Array(\"flag\",\"emoji\"),t.supports={everything:!0,everythingExceptFlag:!0},o=0;o<i.length;o++)t.supports[i[o]]=l(i[o]),t.supports.everything=t.supports.everything&&t.supports[i[o]],\"flag\"!==i[o]&&(t.supports.everythingExceptFlag=t.supports.everythingExceptFlag&&t.supports[i[o]]);t.supports.everythingExceptFlag=t.supports.everythingExceptFlag&&!t.supports.flag,t.DOMReady=!1,t.readyCallback=function(){t.DOMReady=!0},t.supports.everything||(n=function(){t.readyCallback()},a.addEventListener?(a.addEventListener(\"DOMContentLoaded\",n,!1),e.addEventListener(\"load\",n,!1)):(e.attachEvent(\"onload\",n),a.attachEvent(\"onreadystatechange\",function(){\"complete\"===a.readyState&&t.readyCallback()})),(r=t.source||{}).concatemoji?d(r.concatemoji):r.wpemoji&&r.twemoji&&(d(r.twemoji),d(r.wpemoji)))}(window,document,window._wpemojiSettings);\n"
+ " </script>\n"
+ " <style type=\"text/css\">\n"
+ "img.wp-smiley,\n"
+ "img.emoji {\n"
+ " display: inline !important;\n"
+ " border: none !important;\n"
+ " box-shadow: none !important;\n"
+ " height: 1em !important;\n"
+ " width: 1em !important;\n"
+ " margin: 0 .07em !important;\n"
+ " vertical-align: -0.1em !important;\n"
+ " background: none !important;\n"
+ " padding: 0 !important;\n"
+ "}\n"
+ "</style>\n"
+ " <link rel='stylesheet' id='wp-block-library-css' href='http://hdstreams.club/wp-includes/css/dist/block-library/style.min.css?ver=5.3.2' type='text/css' media='all' />\n"
+ "<link rel='stylesheet' id='pkhosting-fonts-css' href='//fonts.googleapis.com/css?family=Playball%3A400%2C700%2C900%7CPoppins%3A300%2C400%2C500%2C600%2C700%7CLato%3A100%2C100i%2C300%2C300i%2C400%2C400i%2C700%2C700i%2C900%2C900i%7CMontserrat%3A400%2C700&subset=latin%2Clatin-ext' type='text/css' media='all' />\n"
+ "<link rel='stylesheet' id='bootstrap_style_min-css' href='http://hdstreams.club/wp-content/themes/pkhosting/css/bootstrap.min.css?ver=5.3.2' type='text/css' media='all' />\n"
+ "<link rel='stylesheet' id='pkhosting-style-css' href='http://hdstreams.club/wp-content/themes/pkhosting/style.css?ver=5.3.2' type='text/css' media='all' />\n"
+ "<link rel='stylesheet' id='font-awesome-min-css' href='http://hdstreams.club/wp-content/themes/pkhosting/css/font-awesome.min.css?ver=5.3.2' type='text/css' media='all' />\n"
+ "<link rel='stylesheet' id='animate_min-css' href='http://hdstreams.club/wp-content/themes/pkhosting/css/animate.min.css?ver=5.3.2' type='text/css' media='all' />\n"
+ "<script type='text/javascript' src='http://hdstreams.club/wp-includes/js/jquery/jquery.js?ver=1.12.4-wp'></script>\n"
+ "<script type='text/javascript' src='http://hdstreams.club/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1'></script>\n"
+ "<script type='text/javascript' src='http://hdstreams.club/wp-content/themes/pkhosting/js/bootstrap.js?ver=5.3.2'></script>\n"
+ "<script type='text/javascript' src='http://hdstreams.club/wp-content/themes/pkhosting/js/jquery.smartmenus.min.js?ver=5.3.2'></script>\n"
+ "<link rel='https://api.w.org/' href='http://hdstreams.club/wp-json/' />\n"
+ "<link rel=\"EditURI\" type=\"application/rsd+xml\" title=\"RSD\" href=\"http://hdstreams.club/xmlrpc.php?rsd\" />\n"
+ "<link rel=\"wlwmanifest\" type=\"application/wlwmanifest+xml\" href=\"http://hdstreams.club/wp-includes/wlwmanifest.xml\" /> \n"
+ "<meta name=\"generator\" content=\"WordPress 5.3.2\" />\n"
+ "<link rel=\"canonical\" href=\"http://hdstreams.club/\" />\n"
+ "<link rel='shortlink' href='http://hdstreams.club/' />\n"
+ "<link rel=\"alternate\" type=\"application/json+oembed\" href=\"http://hdstreams.club/wp-json/oembed/1.0/embed?url=http%3A%2F%2Fhdstreams.club%2F\" />\n"
+ "<link rel=\"alternate\" type=\"text/xml+oembed\" href=\"http://hdstreams.club/wp-json/oembed/1.0/embed?url=http%3A%2F%2Fhdstreams.club%2F&format=xml\" />\n\n"
+ " <style type=\"text/css\">\n"
+ " </style>\n\n"
+ "<style type=\"text/css\">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style><script type=\"text/javascript\">var _gaq = _gaq || [];_gaq.push([\"_setAccount\", \"UA-133782126-8\"]);_gaq.push([\"_trackPageview\"]);(function() {var ga = document.createElement(\"script\"); ga.type = \"text/javascript\"; ga.async = true;ga.src = (\"https:\" == document.location.protocol ? \"https://ssl\" : \"http://www\") + \".google-analytics.com/ga.js\";var s = document.getElementsByTagName(\"script\")[0]; s.parentNode.insertBefore(ga, s);})();</script></head>\n\n"
+ "<body class=\"home page-template-default page page-id-5\">\n"
+ "<div class=\"wrapper\">\n"
+ " <header>\n"
+ " <div class=\"clearfix\"></div>\n"
+ " <div class=\"pk-main-nav\">\n"
+ " <div class=\"container\">\n"
+ " <div class=\"row\">\n"
+ " <div class=\"col-xs-12 col-sm-3\">\n"
+ " <div class=\"navbar-header\">\n"
+ " <!-- Logo -->\n"
+ " \n"
+ " <a class=\"navbar-brand\" href=\"http://hdstreams.club/\"><span class=\"site-title\">HDSTREAMS.CLUB</span>\n"
+ " <br>\n"
+ " <span class=\"site-description\">Watch Soccer, NBA, NFL, Racing and Fighting Games Live</span> \n"
+ " </a> \n"
+ " \n"
+ " <!-- Logo -->\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"col-xs-12 col-sm-9 main-menu\" >\n"
+ " <nav class=\"navbar navbar-default navbar-static-top navbar-wp\">\n"
+ " <!-- navbar-toggle -->\n"
+ " <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar-wp\"> <span class=\"sr-only\"></span> <span class=\"icon-bar\"></span> <span class=\"icon-bar\"></span> <span class=\"icon-bar\"></span> </button>\n"
+ " <!-- /navbar-toggle --> \n"
+ " <!-- Navigation -->\n"
+ " \n"
+ " <div class=\"collapse navbar-collapse\" id=\"navbar-wp\">\n"
+ " \n"
+ " </div>\n"
+ " <!-- /Navigation -->\n"
+ " </nav>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </header>\n"
+ " <!-- #masthead --> \n\n"
+ "<main id=\"content\">\n"
+ " <div class=\"container\">\n"
+ " <div class=\"row\">\n"
+ " <div class=\"col-lg-9 col-md-9\">\n"
+ " <div class=\"single-content-container\">\n"
+ " <div class=\"row\">\n"
+ " <div class=\"col-lg-12\">\n"
+ " <div class=\"page-content\">\n"
+ " <h1>Today’s Schedule</h1> \n"
+ " \n"
+ "<h1><span style=\"text-decoration: underline;\"><span style=\"color: #ff0000; text-decoration: underline;\">Saturday 28 </span></span><span style=\"text-decoration: underline; color: #ff0000;\">December 2019</span></h1>\n\n\n\n"
+ "<h2><span style=\"text-decoration: underline; color: #993300;\">Schedule Time is IST 05:30</span></h2>\n\n\n"
+ "<p>01:15 <span style=\"color: #0000ff;\">Soccer —</span> Wolves Vs Manchester City NBCSN <a href=\"http://hdstreams.club/hd/ch1.php\">CH1</a> EN<br />01:15 <span style=\"color: #0000ff;\">Soccer —</span> Dundee United Vs Dundee FC BT Sport 2 <a href=\"http://hdstreams.club/hd/ch2.php\">CH2</a> EN<br />03:30 <span style=\"color: #0000ff;\">NBA —</span> Cleveland Cavaliers Vs Boston Celtics NBA TV <a href=\"http://hdstreams.club/hd/ch4.php\">CH4</a> EN<br />05:30 <span style=\"color: #0000ff;\">NBA —</span> Oklahoma City Thunder Vs Charlotte Hornets FOX SPORTS OKLAHOMA <a href=\"http://hdstreams.club/hd/ch3.php\">CH3</a> EN<br />05:30 <span style=\"color: #0000ff;\">NBA —</span> Philadelphia 76ers Vs Orlando Magic NBA TV <a href=\"http://hdstreams.club/hd/ch4.php\">CH4</a> EN<br />06:00 <span style=\"color: #0000ff;\">NBA —</span> Milwaukee Bucks Vs Atlanta Hawks FOX SPORTS WISCONSIN <a href=\"http://hdstreams.club/hd/ch5.php\">CH5</a> EN<br />06:30 <span style=\"color: #0000ff;\">NBA —</span> Indiana Pacers Vs Miami Heat FOX SPORTS SUN <a href=\"http://hdstreams.club/hd/ch6.php\">CH6</a> EN<br />09:00 <span style=\"color: #0000ff;\">NBA —</span> Phoenix Suns Vs Golden State Warriors NBA TV <a href=\"http://hdstreams.club/hd/ch4.php\">CH4</a> EN<br />18:00 <span style=\"color: #0000ff;\">Soccer —</span> Brighton Vs Bournemouth NBCSN <a href=\"http://hdstreams.club/hd/ch2.php\">CH2</a> EN<br />20:30 <span style=\"color: #0000ff;\">Soccer —</span> Newcastle Vs Everton NBCSN <a href=\"http://hdstreams.club/hd/ch2.php\">CH2</a> EN<br />20:30 <span style=\"color: #0000ff;\">Soccer —</span> Southampton Vs Crystal Palace SuperSport 5 <a href=\"http://hdstreams.club/hd/ch5.php\">CH5</a> EN<br />20:30 <span style=\"color: #0000ff;\">Soccer —</span> Watford Vs Aston Villa SuperSport 4 <a href=\"http://hdstreams.club/hd/ch4.php\">CH4</a> EN<br />23:00 <span style=\"color: #0000ff;\">Soccer —</span> Norwich Vs Tottenham Sky Sports Main Event <a href=\"http://hdstreams.club/hd/ch6.php\">CH6</a> EN<br />23:00 <span style=\"color: #0000ff;\">Soccer —</span> West Ham Vs Leicester SuperSport 3 <a href=\"http://hdstreams.club/hd/ch3.php\">CH3</a> EN</p>\n\n\n"
+ "<h1><span style=\"text-decoration: underline;\"><span style=\"color: #ff0000; text-decoration: underline;\">Sunday 29 </span></span><span style=\"text-decoration: underline; color: #ff0000;\">December 2019</span></h1>\n\n\n\n"
+ "<h2><span style=\"text-decoration: underline; color: #993300;\">Schedule Time is IST 05:30</span></h2>\n\n\n"
+ "<p>01:15 <span style=\"color: #0000ff;\">Soccer —</span> Burnley Vs Manchester United BT Sport 1 <a href=\"http://hdstreams.club/hd/ch1.php\">CH1</a> EN<br />03:30 <span style=\"color: #0000ff;\">NBA —</span> Memphis Grizzlies Vs Denver Nuggets FOX SPORTS SOUTHEAST – MEMPHIS <a href=\"http://hdstreams.club/hd/ch7.php\">CH7</a> EN<br />05:30 <span style=\"color: #0000ff;\">NBA —</span> Toronto Raptors Vs Boston Celtics TSN1 <a href=\"http://hdstreams.club/hd/ch8.php\">CH8</a> EN<br />05:30 <span style=\"color: #0000ff;\">NBA —</span> Indiana Pacers Vs New Orleans Pelicans FOX SPORTS NEW ORLEANS <a href=\"http://hdstreams.club/hd/ch9.php\">CH9</a> EN<br />06:30 <span style=\"color: #0000ff;\">NBA —</span> Philadelphia 76ers Vs Miami Heat NBA TV CANADA <a href=\"http://hdstreams.club/hd/ch10.php\">CH10</a> EN<br />06:30 <span style=\"color: #0000ff;\">NBA —</span> New York Knicks Vs Washington Wizards MSG <a href=\"http://hdstreams.club/hd/ch11.php\">CH11</a> EN<br />06:30 <span style=\"color: #0000ff;\">NBA —</span> Atlanta Hawks Vs Chicago Bulls NBC SPORTS CHICAGO <a href=\"http://hdstreams.club/hd/ch12.php\">CH12</a> EN<br />06:30 <span style=\"color: #0000ff;\">NBA —</span> Brooklyn Nets Vs Houston Rockets Yes Network <a href=\"http://hdstreams.club/hd/ch13.php\">CH13</a> EN<br />06:30 <span style=\"color: #0000ff;\">NBA —</span> Cleveland Cavaliers Vs Minnesota Timberwolves FOX SPORTS OHIO <a href=\"http://hdstreams.club/hd/ch14.php\">CH14</a> EN<br />07:00 <span style=\"color: #0000ff;\">NBA —</span> Orlando Magic Vs Milwaukee Bucks FOX SPORTS WISCONSIN <a href=\"http://hdstreams.club/hd/ch15.php\">CH15</a> EN<br />07:00 <span style=\"color: #0000ff;\">NBA —</span> Detroit Pistons Vs San Antonio Spurs FOX SPORTS DETROIT <a href=\"http://hdstreams.club/hd/ch16.php\">CH16</a> EN<br />07:00 <span style=\"color: #0000ff;\">NBA —</span> Dallas Mavericks Vs Golden State Warriors NBC SPORTS BAY AREA <a href=\"http://hdstreams.club/hd/ch17.php\">CH17</a> EN<br />07:30 <span style=\"color: #0000ff;\">NBA —</span> Phoenix Suns Vs Sacramento Kings NBC SPORTS CALIFORNIA <a href=\"http://hdstreams.club/hd/ch18.php\">CH18</a> EN<br />07:30 <span style=\"color: #0000ff;\">Boxing —</span> Gervonta Davis Vs Yuriorkis Gamboa ShowTime <a href=\"http://hdstreams.club/hd/ch2.php\">CH2</a> EN<br />08:30 <span style=\"color: #0000ff;\">UFC —</span> Fedor Vs Rampage Paramount Network <a href=\"http://hdstreams.club/hd/ch4.php\">CH4</a> EN<br />08:30 <span style=\"color: #0000ff;\">NBA —</span> Los Angeles Lakers Vs Portland Trail Blazers NBA TV CANADA <a href=\"http://hdstreams.club/hd/ch10.php\">CH10</a> EN<br />09:00 <span style=\"color: #0000ff;\">NBA —</span> Utah Jazz Vs LA Clippers FOX SPORTS PRIME TICKET <a href=\"http://hdstreams.club/hd/ch19.php\">CH19</a> EN</p> </div>\n"
+ " <div class=\"col-lg-12\">\n"
+ "<hr>\n"
+ "<div id=\"comments\" class=\"comments-area\">\n"
+ " \n"
+ "</div><!-- #comments -->\n"
+ "</div> </div>\n"
+ " </div> \n"
+ " </div> \n"
+ " </div>\n"
+ " <!--Sidebar Area-->\n"
+ " <aside class=\"col-md-3 col-lg-3\">\n"
+ " \n"
+ "<aside id=\"secondary\" class=\"widget-area\" role=\"complementary\">\n"
+ " <div id=\"sidebar-right\" class=\"pk-sidebar\">\n"
+ " <div id=\"search-2\" class=\"pk-widget widget_search bounceInRight animated\"><form method=\"get\" id=\"searchform\" action=\"http://hdstreams.club/\">\n"
+ " <div class=\"input-group\">\n"
+ " <input type=\"text\" class=\"form-control\" name=\"s\" id=\"s\" placeholder=\"type to search\" />\n"
+ " <span class=\"input-group-btn btn-default \">\n"
+ " <button type=\"submit\" class=\"btn\"> <i class=\"fa fa-search\"></i> </button>\n"
+ " </span> </div>\n"
+ "</form></div> <div id=\"recent-posts-2\" class=\"pk-widget widget_recent_entries bounceInRight animated\"> <h6>Recent Posts</h6> <ul>\n"
+ " <li>\n"
+ " <a href=\"http://hdstreams.club/schedule/\">Schedule</a>\n"
+ " </li>\n"
+ " </ul>\n"
+ " </div><div id=\"recent-comments-2\" class=\"pk-widget widget_recent_comments bounceInRight animated\"><h6>Recent Comments</h6><ul id=\"recentcomments\"></ul></div><div id=\"archives-2\" class=\"pk-widget widget_archive bounceInRight animated\"><h6>Archives</h6> <ul>\n"
+ " <li><a href='http://hdstreams.club/2019/11/'>November 2019</a></li>\n"
+ " </ul>\n"
+ " </div><div id=\"categories-2\" class=\"pk-widget widget_categories bounceInRight animated\"><h6>Categories</h6> <ul>\n"
+ " <li class=\"cat-item cat-item-1\"><a href=\"http://hdstreams.club/category/uncategorized/\">Uncategorized</a>\n"
+ "</li>\n"
+ " </ul>\n"
+ " </div><div id=\"meta-2\" class=\"pk-widget widget_meta bounceInRight animated\"><h6>Meta</h6> <ul>\n"
+ " <li><a href=\"http://hdstreams.club/wp-login.php\">Log in</a></li>\n"
+ " <li><a href=\"http://hdstreams.club/feed/\">Entries feed</a></li>\n"
+ " <li><a href=\"http://hdstreams.club/comments/feed/\">Comments feed</a></li>\n"
+ " <li><a href=\"https://wordpress.org/\">WordPress.org</a></li> </ul>\n"
+ " </div> </div>\n"
+ "</aside><!-- #secondary --> </aside>\n"
+ " <!--Sidebar Area-->\n"
+ " </div>\n"
+ " </div>\n"
+ "</main>\n"
+ "<!--==================== pk-FOOTER AREA ====================-->\n"
+ "<footer> \n"
+ " <div class=\"overlay\"> \n"
+ " <!--Start pk-footer-widget-area-->\n"
+ " <!--End pk-footer-widget-area-->\n"
+ " <div class=\"pk-footer-copyright\">\n"
+ " <div class=\"container\">\n"
+ " <div class=\"row\">\n"
+ " <div class=\"col-md-6\">\n"
+ " <p>© 2019 HDSTREAMS.CLUB | Theme by <a href=\"https://pkhosting.com/\" rel=\"designer\">PKHosting</a></p>\n"
+ " </div>\n"
+ " <div class=\"col-lg-6 col-sm-6 text-right\">\n"
+ " <ul class=\"pk-social\">\n"
+ " </ul>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ "</footer>\n"
+ "</div>\n"
+ "<!--Scroll To Top--> \n"
+ "<a href=\"#\" class=\"ti_scroll bounceInRight animated\"><i class=\"fa fa-angle-double-up\"></i></a> \n"
+ "<!--/Scroll To Top-->\n"
+ "<script type='text/javascript' src='http://hdstreams.club/wp-includes/js/wp-embed.min.js?ver=5.3.2'></script>\n"
+ "</body>\n"
+ "</html>";
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