[TxMt] Re placing a space with an underscore in Snippet
Ian Alexander Wood
ianalexanderwood at gmail.com
Fri Feb 20 19:42:14 UTC 2009
Hello.
I am a newcomer to the world of Textmate having previously designed websites
with Dreamweaver. I love the snippet functionality and have set about
creating loads of my own snippets for speedy XHTML coding.
I've hit a small snag whilst trying to get a regular expression to reproduce
text in two places in my snippet. The problem I am having is trying to tell
it to replace any spaces with say an underscore _ character.
Forgive me if this is easy to do, I am quite new to Regular Expressions and
I'm still feeling my way!
Here is the offending snippet:
<form action="${1:${TM_FILENAME/(.*?)\..*/$1_submit/}}" method="${2:post}"
accept-charset="utf-8">
<fieldset id="${6:${3/[[:alpha:]]+|( )/(?3:_:\L$0)/g}}"
${4:class="${5:}"}>
<legend>${3:enter form name}</legend>
$0
<button type="submit">submit</button><br/>
</fieldset>
</form>
So placeholder number 3 is the legend name and also populates the fieldset
ID. I can easily change the ID manually if it contains spaces, but I thought
it would be really cool if it would just replace them automatically with an
underscore instead.
Any help would be much appreciated!
Kind regards,
Ian
--
View this message in context: http://www.nabble.com/Replacing-a-space-with-an-underscore-in-Snippet-tp22126048p22126048.html
Sent from the textmate users mailing list archive at Nabble.com.
More information about the textmate
mailing list