[TxMt] Re: Templates: regex: just not working

gvdgdo gvdgdo at gmail.com
Tue Oct 7 22:05:26 UTC 2008


On 08/10/2008, at 7:49 AM, Complex wrote:

> OK, this is explained pretty well, if briefly, in the Help document,
> but it doesn't work. Probably I'm making a stupid mistake, but I've
> been trying to tackle this for days.
>
> I've made a template and am editing its associated template file.
>
> This works, wrapping the selected text in a div:
> <div>
> ${TM_SELECTED_TEXT}
> </div>
>
> However, this doesn't work. It should recognize three words separated
> by spaces and wrap them in paragraphs. The find pattern *does* work in
> the Find command, but not in the template.
>
> The result of htis pattern is emptiness; I get just the div tags
> around a blank line.
>
> <div>
> ${TM_SELECTED_TEXT/^(\S+?)\s(\S+?)\s(\S+?)$/<p>$1</p>\r<p>$3</p>\r<p> 
> $3</p>/g/}
> </div>
>

replace </p> with <\/p> (uyou have to escape /) otherwise they will be  
understood as the termination of the regexp expressions.

Guido
--
Guido Governatori
http://www.governatori.net  http://www.governatori.net/TextMate



More information about the textmate mailing list