[TxMt] Templates: regex: just not working

Complex complex.confusion at gmail.com
Tue Oct 7 21:49:00 UTC 2008


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>

The above code looks like it follows the regex patterns described in
Help's regex section. So I'm unsure what's wrong. Help, please!

-- CC



More information about the textmate mailing list