Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><code>"(?=(?:\d{3})++(?!\d))"</code> is a <a href="http://www.regular-expressions.info/lookaround.html" rel="nofollow noreferrer">lookahead assertion</a>.</p> <p>It means <em>"only match if followed by ((three digits that we don't need to capture) repeated one or more times (and again repeated one or more times) (not followed by a digit))"</em>. See this <a href="http://www.regular-expressions.info/brackets.html" rel="nofollow noreferrer">explanation</a> about <code>(?:...)</code> notation. It's called non-capturing group and means you don't need to reference this group after the match.</p> <p><code>"(\\G-?\\d{1,3})"</code> is the part that should actually match (but only if the above-described conditions are met).</p> <p>Edit: I think <code>+</code> must be a special character, otherwise it's just a plus. If it's a special character (and quick search suggests that <a href="http://java.sun.com/developer/technicalArticles/releases/1.4regex/" rel="nofollow noreferrer">it is in Java, too</a>), the second one is redundant.</p> <p>Edit 2: Thanks to <a href="https://stackoverflow.com/questions/10055885/this-regex-line-exceeds-my-understanding-d3-d/10056023#comment12868478_10056023">Alan Moore</a>, it's now clear. The second <code>+</code> means possessive matching, so it means that if after checking as many 3-digit groups as possible it won't find that they're not followed by a non-digit, the engine will immediately give up instead of stepping one 3-digit group back.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload