javascript - Capturing a pattern multiple times -


I want to parse all the links inside the HTML string, as it looks like the following:

  & lt; A href = "Javascript: makepop ('match_stats_popup.php? MatchID = 185934701')" & gt; Match stats & lt; / A & gt; & Lt; A href = "javascript: makepop ('http://www.atpworldtour.com/Share/Match-Facts-Pop-Up.aspx?t=416&y=2014&r=5&p=p643')" & Gt; Match stats & lt; / A & gt;  

There is an array of expected output links:

  ['match_stats_popup.php? MatchID = 185934701, 'http: //www.atpworldtourcom / share / match-facts-pop-up.aspx? T = 416 & y = 2014 & amp; R = 5 & amp; I have created this function but it does ":  
  function parseMatchStatsLinks (html) {var regex = / href ="  Javascript: makePopup \ ('(. *)' \) "/ G; var match = []; var link = [], while (match = regex.exec (html)) {links.push (match [1]) ;} Return link;}  

To make it non-greedy, ? was to add:

  href = "javascript: makepup \ ('(. *?)' \" " 

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -