[TxMt] Re: Select and Replace: magic needed....

Alex Ross tm-alex at rosiba.com
Mon Jun 15 19:01:29 UTC 2009


On Jun 15, 2009, at 11:45 AM, Nicholas Cole wrote:

> On Mon, Jun 15, 2009 at 7:24 PM, Scott Haneda<talklists at newgeo.com>  
> wrote:
>> On Jun 15, 2009, at 11:11 AM, Nicholas Cole <nicholas.cole at gmail.com>
>
>> Curious... Is your desired text to change always structured the same?
>>
>> Why not use a regex based find and replace and connect that to a hot
>> key via a bundle?
>
> The problem with a regex is that the British use of single quotes
> makes apostrophes confusing.
>
> So:
>
>> This is `some of Jefferson's text'
>
> Needs to become:
>
>> This is \enquote{some of Jefferson's text}
>
> I think only a human can get that right reliably.

You need smarter regex's :)

How about:

`(.*?)'(?!s)

So it starts by matching `, and matches until it finds a single ' that  
is not followed by “s”.

Now you can replace this with

\enquote{$1}

—Alex


More information about the textmate mailing list