[TxMt] Re: regex in a snippet
Oliver Taylor
olivertaylor at me.com
Tue Mar 17 22:09:44 UTC 2009
2009/3/17 Saul Rosenbaum <saul at visualchutzpah.com>:
> Alas I wish there where more basic explanation in the docs I can't for the life of me figure it out..
I can't remember where I got this, but it should do the trick. Been
using it for ages.
<h2 id="${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}">${1:$TM_SELECTED_TEXT}</h2>
* * *
This snippet uses a placeholder:
${1:placeholder-text}
This snippet mirrors what you type in another place:
${1:Hello}
#1 gets mirrored here: $1
${2:Type something else here}
and #2 gets mirrored here: $2
This snippet replaces spaces with underscores:
${1:Text with spaces}
Mirrored with transformations: ${1/( )/_/g}
Hope this helps clear things up.
More information about the textmate
mailing list