[TxMt] Re: possible format strings bug

Allan Odgaard mailinglist at textmate.org
Fri Apr 4 14:58:41 UTC 2014


On 4 Apr 2014, at 21:45, Matt Neuburg wrote:

> Find expression (regex):
>
> ^(=+)
>
> Replace expression:
>
> ${1/=(=)?(=)?/${2:?2:${1:?1:0}}/}
>
> Do a replace all […]

The problem is that your first search string ‘^(=+)’ populates 
capture register $1 and the nested replacements inherit variables from 
parent matches.

In your case, you can lose the parentheses. If you needed captures in 
the root search and conditionals in a nested replacement, a workaround 
would be to use named captures (to avoid clashes).


More information about the textmate mailing list