<div dir="ltr">Hi all,<div><br></div><div>I <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">have encountered an unexpected challenge constructing a regex for a pattern I am looking for.  I </span>am looking for numbers in parentheses.  For example, in the following string:</div><div><br></div><div><div>  "On February 13, 1968, Secretary of State Dean Rusk sent a </div><div>    message to Israeli Foreign Minister Abba Eban calling upon Israel to </div><div>    endorse openly Resolution 242, and on May 13 President Johnson sent a </div><div>    letter to United Arab Republic (UAR) President Gamal Abdel Nasser, </div><div>    urging him to seize the unique opportunity offered by the Jarring </div><div>    mission to achieve peace. (79, 171)"</div></div><div><br></div><div>... I would like to match "79" and "171" (but not "UAR" or "13" or "1968").  I have been trying to construct a regex for use with analyze-string to capture this pattern, but I have not been successful.  I have tried the following:</div><div><br></div><div>  analyze-string($string, "(?:\()(?:(\d+)(?:, )?)+(?:\))")</div><div><br></div><div>In other words, there are these 3 components:</div><div><br></div><div>  1. (?:\() a non-capturing group consisting of an open parens, followed by</div><div>  2. (?:(\d+)(?:, )?)+ one or more non-capturing groups consisting of (a number followed by an optional, non-matching comma-and-space), followed by</div><div>  3. (?:\)) <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">a non-capturing group consisting of<span> a</span></span> close parens</div><div><br></div><div>I was expecting to get the following output:</div><div><br></div><div><div>  <fn:analyze-string-result xmlns:fn="<a href="http://www.w3.org/2005/xpath-functions" target="_blank">http://www.w3.org/2005/xpath-functions</a>"></div><div>    <fn:non-match>On February 13, 1968, Secretary of State Dean Rusk sent a </div><div>    message to Israeli Foreign Minister Abba Eban calling upon Israel to </div><div>    endorse openly Resolution 242, and on May 13 President Johnson sent a </div><div>    letter to United Arab Republic (UAR) President Gamal Abdel Nasser, </div><div>    urging him to seize the unique opportunity offered by the Jarring </div><div>    mission to achieve peace. </fn:non-match></div><div>    <fn:match>(<fn:group nr="1">79</fn:group>, </div><div>      <fn:group nr="1">171</fn:group>)</fn:match></div><div>  </fn:analyze-string-result></div></div><div><br></div><div>However, the actual result is that the first number ("79") is skipped, and only the 2nd number ("171") is captured:</div><div><br></div><div><div>  <fn:analyze-string-result xmlns:fn="<a href="http://www.w3.org/2005/xpath-functions" target="_blank">http://www.w3.org/2005/xpath-functions</a>"></div><div>    <fn:non-match>On February 13, 1968, Secretary of State Dean Rusk sent a </div><div>    message to Israeli Foreign Minister Abba Eban calling upon Israel to </div><div>    endorse openly Resolution 242, and on May 13 President Johnson sent a </div><div>    letter to United Arab Republic (UAR) President Gamal Abdel Nasser, </div><div>    urging him to seize the unique opportunity offered by the Jarring </div><div>    mission to achieve peace. </fn:non-match></div><div>    <fn:match>(79, </div><div>      <fn:group nr="1">171</fn:group>)</fn:match></div><div>  </fn:analyze-string-result></div></div><div><br></div><div>What am I missing?  Can anyone suggest a regex that is able to capture both numbers inside the parentheses?  Or do I need to make a two-pass run through this, finding parenthetical text with a first analyze-string like "\(.+\)" and then looking inside its matches with a second analyze-string like "(\d+)(?:, )?"?</div><div><br></div><div>Thanks,</div><div>Joe</div></div>