[TxMt] Stripping certain characters in snippets

Allan Odgaard throw-away-1 at macromates.com
Mon Jun 19 10:45:12 UTC 2006


On 18/6/2006, at 21:47, Daniel Käsmayr wrote:

> The LaTeX snippets for sections, when they contain a label, look  
> like this:
>
> \section{${1:section name}}\label{sec:${2:${1/(\w+)|\W+/(?1:\L$0:)/ 
> g}}}
>
> Somehow (I don't get the syntax for this yet)

The feature used is transformations [1].

As for the (?1:\L$0:): \L is a case folding [2] and the parenthesis  
is a condition [3].

> the $2 part strips non-word characters from $1. Is it also possible  
> to do transformations like replacing umlauts äöü with aou?

Not without stating each transformation explicitly and making the  
snippet even more cryptic.


[1] http://macromates.com/textmate/manual/snippets#transformations
[2] http://macromates.com/textmate/manual/ 
regular_expressions#case_foldings
[3] http://macromates.com/textmate/manual/ 
regular_expressions#conditional_insertions




More information about the textmate mailing list