[TxMt] Snippet regex transformation help

Allan Odgaard throw-away-1 at macromates.com
Thu Oct 5 14:57:42 UTC 2006


On 5. Oct 2006, at 16:38, Ed Singleton wrote:

> I'm trying to use a regex transformation in a snippet that will
> convert the first letter of a word to uppercase and convert underscore
> _ followed by a letter to a space and an uppercase letter.
>
> eg:
>
> field_name > Field Name
> long_field_name > Long Field Name

I think this should do: ${1/([a-z]+)(_)?/\u$1(?2: )/g}

> [...] Is there a collection of regexes for transforming between the  
> main
> cases?

Nope -- I’ve been wanting to start sort of a recipes section in the  
manual, sounds like these would be good examples to have there :)






More information about the textmate mailing list