[TextMate] Re: Working with selections and macros/commands?

Allan Odgaard allan at macromates.com
Sun Oct 10 03:14:12 UTC 2004


On 10. Oct 2004, at 1:54, bongoman wrote:

> Got it. It's a command. I now realise I can echo text back to replace
> selected text. Excellent.

Another possibility is recording a macro that uses regex 
search'n'replace with scope set to selection.

This allows to check for conditions like the 'Selection as Anchor' 
which does:

    findString:    ^(.*@.*\..*)|.*$
    replaceString: <a href="(?1mailto\:$0:$0.html)">$0</a>

The find string matches an email as capture 1 _or_ it matches anything.

The format string makes it into an anchor and _if_ there is a first 
capture, it prefixes $0 (the entire match) with mailto:, otherwise it 
uses .html as suffix.



Kind regards Allan




More information about the textmate mailing list