<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">You can combine Multiple Carets and Copy + Paste to achieve this easily.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Find a list of the numbers you want to use, I assume you’re capable of generating the list in some way, but I like using the `seq` command in the terminal such as:</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div id="bloop_customfont" style="margin: 0px;"><font face="Courier New">$ seq 16 32</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier New">16</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier New">17</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Helvetica">[…snip...]</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier New">31</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier New">32</font></div></blockquote><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;"><font face="Helvetica">Note: It is important that they be separated by new line characters.</font></div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;"><font face="Helvetica">Copy this list.</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Helvetica"><br></font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Helvetica">Select your first placeholder: “##"</font></div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier">  <PortalOBj portalFlags="16" numbOfRows="1" initialRow=“<font color="#009051">##</font>”></font></div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Press Control + W, this selects the next placeholder. Repeat until your selection contains all of your placeholders.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Paste.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_sign_1424445688772459008" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">Graham P Heath<br><br></div></div> <br><p style="color:#000;">On February 20, 2015 at 8:29:30 AM, René Schwaiger (<a href="mailto:sanssecours@f-m.fm">sanssecours@f-m.fm</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>Hi jgaltUSA,
<br>
<br>> On 20 Feb 2015, at 9:50 , jgaltUSA <jgaltUSA@gmail.com> wrote:
<br>>  
<br>> I am a newbie to textmate and I am trying to perform a find and replace. I want to replace the matched text with a sequential number.  
<br>>  
<br>> Here is my current replacement string: $1##$2  
<br>>  
<br>> How can I replace the ## with a sequential number?  
<br>
<br>I do not think that what you want is possible using only regular expressions and “Find & Replace”. It is possible and not to complex using a programming language. The following code does what you want:
<br>
<br>    #!/usr/bin/env python
<br>
<br>    from re import compile
<br>    from sys import stdin, stdout
<br>
<br>    regex = compile(
<br>        """(<PortalOBj portalFlags="16" numbOfRows="1" initialRow=")\d+(">)""")
<br>    index = 16
<br>
<br>    def create_subtitute_function():
<br>        def substitute(match):
<br>            global index
<br>            replacement = "{}{}{}".format(match.group(1), index, match.group(2))
<br>            index += 1
<br>            return replacement
<br>
<br>        return substitute
<br>
<br>    text = regex.sub(create_subtitute_function(), stdin.read())
<br>    stdout.write(text)
<br>
<br>I attached a bundle which contains a command that uses the above code. To install the bundle just double click it. You can apply the substitution on some text by pressing the key combination “^⌥⌘R”. Since the above is my code I would be careful when you use the command though :).
<br>
<br>> For example, I want the first sequential number to be 16.  
<br>>  
<br>> Here is a screen capture:   
<br>>  
<br>> Thanks!
<br>
<br>Kind regards,
<br>  René
<br>
<br>P.S.: You can create a screenshot of a single window by using the key combination “⇧⌘4”. After that just hit “Space” and a click on the window you would like to make a screenshot of. This way you do not need to crop the picture.
<br>
<br><hr>
<br>_______________________________________________
<br>textmate mailing list
<br>textmate@lists.macromates.com
<br>http://lists.macromates.com/listinfo/textmate</div></div></span></blockquote></body></html>