<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>To learn more about RegEx, I can recommend <a
        href="http://regexr.com/3coa1">Regexr.com</a> (<a
        href="http://regexr.com/3coa1">with your case</a>). It is based
      on the JavaScript implementation, so there are limits, but it's a
      good start.</p>
    As Carpii said, you define “capture groups” with parentheses.
    TextMate Find & Replace behaves like <a
      href="http://php.net/manual/en/function.preg-match.php"
      title="php.net">PHP's preg_match</a>, so the “entire match” is in
    <code style="background-color:#EEE;padding:1px 2px;">$0</code>. In
    this case you need the entire line unbroken, so that's why <code
      style="background-color:#EEE;padding:1px 2px;">$0</code> works.
    <p>If instead you want to change:</p>
    <code style="background-color:#EEE;padding:1px 2px;">PRODUCTS
      2::prnt_material_width </code>
    <p>to</p>
    <code style="background-color:#EEE;padding:1px 2px;">getValue(
      PRODUCTS 2 ; prnt_material_width ; 1) ;</code>
    <p>You would need to match the two groups separately:</p>
    <code style="background-color:#EEE;padding:1px 2px;">^(.+)::(.+)$</code>
    <p>Replace with:</p>
    <code style="background-color:#EEE;padding:1px 2px;">getValue( $1 ;
      $2 ; 1) ;</code>
    <p>I use <code style="background-color:#EEE;padding:1px 2px;">+</code>
      instead of <code style="background-color:#EEE;padding:1px 2px;">*</code>,
      because <code style="background-color:#EEE;padding:1px 2px;">+</code>
      requires a minimum of 1 character. It's a habit.</p>
    <p>And of course there are <a href="http://xkcd.com/208"
        title="xkcd 208">many practical applications to knowing regular
        expressions</a>.</p>
    <p style="margin:2em 0 4em 0">Rasmus</p>
    <div class="moz-cite-prefix">On 07/02/16 19.14, Carpii UK wrote:<br>
    </div>
    <blockquote
cite="mid:CAHvoxhE=mcHybwQZSxXnWX5vT6=yqanfAng70b8WbVTcN7oy4Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
              <div style="word-wrap:break-word">
                <div>
                  <div><br>
                  </div>
                  <div>Can you please help me understand what is
                    happening between these two expressions?</div>
                  <div><br>
                  </div>
                  <div>
                    <div>^   beginning of the line</div>
                    <div><br>
                    </div>
                  </div>
                </div>
                <blockquote style="margin:0px 0px 0px
                  40px;border:none;padding:0px">
                  <div>
                    <div>
                      <div>.*::.*</div>
                    </div>
                  </div>
                </blockquote>
                <div>
                  <div>
                    <div><br>
                    </div>
                    <div>$  end of the line</div>
                  </div>
                </div>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div><br>
            </div>
            <div><br>
            </div>
            <div>
              <div>
                <div>^   match the beginning of the line</div>
                <div><br>
                </div>
                <div>.* followed by 0 or more characters (apart from
                  newline)</div>
                <div><br>
                </div>
                <div>:: followed by 2 literal colon characters</div>
                <div><br>
                </div>
                <div>.* followed by 0 or more characters (apart from
                  newline)</div>
              </div>
              <div><br>
              </div>
              <div>
                <div style="font-size:13.6px">
                  <div>$  followed by the end of the line (a \n
                    character)</div>
                  <div><br>
                  </div>
                  <div><br>
                  </div>
                </div>
              </div>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
              <div style="word-wrap:break-word">
                <div>
                  <div>also…<br>
                  </div>
                  <div><br>
                  </div>
                  <div>can you please tell me what the zero after the $
                    doing in this string?</div>
                  <div><br>
                  </div>
                </div>
                <blockquote style="margin:0px 0px 0px
                  40px;border:none;padding:0px">
                  <div>
                    <div>getValue( $0; 1) ;</div>
                  </div>
                </blockquote>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div><br>
            </div>
            <div>The $0 is a way of referencing one of the captures the
              regular expression made</div>
            <div>I'm not entirely sure this capturing syntax is right,
              normally I use brackets to capture, yet it seems to work
              in textmate. </div>
            <div><br>
            </div>
            <div>We need to do this otherwise we don't know what to
              output after getValue(</div>
            <div><br>
            </div>
            <div><br>
            </div>
            <div><br>
            </div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
              <div style="word-wrap:break-word"><span class="">
                  <div>
                    <div><br>
                    </div>
                    <div><br>
                    </div>
                    <div><br>
                      <div>
                        <blockquote type="cite">
                          <div>On Feb 7, 2016, at 7:29 AM, Carpii UK
                            <<a moz-do-not-send="true"
                              href="mailto:carpii.uk@gmail.com"
                              target="_blank">carpii.uk@gmail.com</a>
                            > wrote:</div>
                          <br>
                          <div><span
style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Try
                              using a regular expression like this..</span>
                            <div
style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>
                            </div>
                            <div
style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a
                                moz-do-not-send="true"
                                href="http://carpii.homeip.net/skitch/Find-20160207-132857.png"
                                target="_blank"><a class="moz-txt-link-freetext" href="http://carpii.homeip.net/skitch/Find-20160207-132857.png">http://carpii.homeip.net/skitch/Find-20160207-132857.png</a></a>
                              <br>
                            </div>
                            <div
style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>
                            </div>
                            <div
style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">The
                              expression is ^.*::.*$</div>
                          </div>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </div>
                </span>
              </div>
              <br>
              <br>
              _______________________________________________<br>
              textmate mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:textmate@lists.macromates.com">textmate@lists.macromates.com</a>
              <br>
              <a moz-do-not-send="true"
                href="http://lists.macromates.com/listinfo/textmate"
                rel="noreferrer" target="_blank">http://lists.macromates.com/listinfo/textmate</a>
              <br>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
textmate mailing list
<a class="moz-txt-link-abbreviated" href="mailto:textmate@lists.macromates.com">textmate@lists.macromates.com</a>
<a class="moz-txt-link-freetext" href="http://lists.macromates.com/listinfo/textmate">http://lists.macromates.com/listinfo/textmate</a></pre>
    </blockquote>
    <br>
  </body>
</html>