[TxMt] regular expression to count words OR inserting shell output in regular expressions

Abhimanyu Lad alad at cs.cmu.edu
Fri Dec 5 06:07:30 UTC 2008

I am trying to write a snippet that allows me to write a helpful usage
string for my Python script, and then automatically insert a "if
len(argv) != ..." thing below that:

		$TM_FILENAME ${1:args}

		if len(argv) != <some regex that counts number of words in $1>:


Depending on the number of words that I enter for args, I want the
appropriate number to be inserted in front of "if len(argv) != ...".
What regular expression can do that?

If a regex can't do that, can I somehow insert the results of a shell
script (e.g. wc) in a regular expression (which, by the way, seems
like a useful thing to be able to do anyways!).


More information about the textmate mailing list