title: Regex Lookahead and Lookbehind clarifications
body: <p>Ok so I know there are some Regex questions out here on <strong>lookahead</strong> and <strong>lookbehind</strong>, but I haven't found some anwsers, to my interior questions, <em>that I can easily relate to</em> (...oh well).</p>
  <p>So here's how I understand Regex lookahead and lookbehind!</p>
  <h3> Lookaheads/Lookbehinds (LA/LB) : </h3>
  <blockquote>
  <h2>LA/LB preceding main Regex</h2>
  <pre><code>(?=IF_YOU_FIND_WHAT_IS_HERE)START_MATCHING_WHAT_IS_HERE
  (?!IF_YOU_DO_NOT_FIND_WHAT_IS_HERE)START_MATCHING_WHAT_IS_HERE
  </code></pre>
  <h2>LA/LB succeeding main Regex</h2>
  <pre><code>START_MATCHING_WHAT_IS_HERE(?=UNTIL_THIS IS_NOT TRUE)
  START_MATCHING_WHAT_IS_HERE(?!UNTIL_THIS IS_NOT TRUE)
  </code></pre>
  </blockquote>
  <p>Ok so for the second part ( <strong>succeeding</strong> ), I'm really not sure and I would appreciate some rewriting of the above notations or some thumbs up for my excellent understanding (oh yeah).</p>
  <p>So back on earth, as I understand it, after each character it matches in the &quot;main&quot; Regex...</p>
  <ol>
  <li>Positive lookahead : it checks if what lies ahead still matches with the lookahead part.</li>
  <li>Negative lookahead : it checks if what lies ahead still doesn't match the lookahead part.</li>
  <li>Positive lookbehind : it checks if what has been matched still matches the lookbehind part</li>
  <li>Negative lookbehind : it checks if what has been matched still doesn't match the lookbehind part.</li>
  </ol>
  <h3> Now, for the SRLC section (Super Regex Lookout Combos) </h3>
  <blockquote>
  <p>Let's look at this Regex</p>
  <pre><code>(?&lt;=REGEX_1)(?&lt;!REGEX_2((MAIN_REGEX(?&lt;!REGEX_3))(?=REGEX_4)))
  </code></pre>
  </blockquote>
  <p>My strategy in approching this would be, well, in some cases, we could combine REGEX_1 and REGEX_2. If that was the case, we would have :</p>
  <blockquote>
  <pre><code>(?&lt;=REGEX_C)((MAIN_REGEX(?&lt;!REGEX_3))(?=REGEX_4))
  </code></pre>
  <p>C for : Combined</p>
  </blockquote>
  <p>Essentially, what I understand is that :</p>
  <ol>
  <li>REGEX_C must succeed first in order to for the MAIN_REGEX starts matching</li>
  <li>Then, the MAIN_REGEX starts matching <strong>character-by-character</strong></li>
  <li>Immediately after <strong>a positive-match</strong>, REGEX_3 analyses the <strong>global</strong> match.</li>
  <li>Next after is the REGEX_4, who will look ahead to see if all is good.</li>
  <li>Then we start over from 2 <strong>and try matching the next character</strong>.</li>
  <li>*Of course, if any REGEX fails, the <strong>global match</strong> is reseted.</li>
  </ol>
  <p>I have no clue, if what I wrote is accurate haha. It's to0 messy when I want to try it out. Most of the time I succeed by trial and errors, but I would like to have somes clarifications so I can get it on my first try. Boom</p>
  <p>Thanks for your replies!</p>