fork download
  1. import java.util.regex.*;
  2.  
  3. class ha {
  4. public static void main (String[] args) {
  5. String s = "<a name='bill_pay' href='javascript:goto(&#39;billpay&#39;);' class='fsdnav-top-menu-item'>Bill Pay <span class='fsdnav-ada-hidden'>link and menu. Press enter to navigate to this link. Press control + space to open submenu.\n" +
  6. "To move through submenu items press tab and then press up or down arrow.</span> </a>\n" +
  7. "<a name='bill_pay' href='javascript:goto(&#39;findmyinfo&#39;);' class='fsdnav-top-menu-item'>\n" +
  8. "<a name='bill_pay' href='#' onClick='OOLPopUp(&#39;/myaccounts/brain/redirect.go?target=findmyroutingnumber&#39;,&#39;ool&#39;,&#39;currentPage&#39;);return false;' class='fsdnav-top-menu-item'>\n" +
  9. "Bill Pay <span class='fsdnav-ada-hidden'>link and menu. Press enter to navigate to this link. Press control + space to open submenu.";
  10. Pattern regex = Pattern.compile("^(?:.*?goto\\(&#39;(\\w+)&#39;\\).*|.*?OOLPopUp\\(&#39;(.+?&#39;\\)).*)$", Pattern.MULTILINE);
  11. Matcher matcher = regex.matcher(s);
  12. while(matcher.find()) {
  13. System.out.println(matcher.group(1) != null ?
  14. matcher.group(1) : matcher.group(2)
  15. );
  16. }
  17. }
  18. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
billpay
findmyinfo
/myaccounts/brain/redirect.go?target=findmyroutingnumber&#39;,&#39;ool&#39;,&#39;currentPage&#39;)