[TxMt] Class path generation with regexp

Sam Thorne sam at native.com
Fri Nov 3 12:15:42 UTC 2006

Hi List,

I'm playing around with templates for Actionscript, at the moment  
all's working fine except the class path of the new class I'm  

I'm using the TM_DIRECTORY  variable in combination with the  
TM_NEW_FILE_BASENAME as in the original AS template and attempting to  
parse it with a regexp to change it from a file path the the class path.

i.e. change _workingcopy/com/native/project/package/ClassName to  

My limited grasp of regexp is tripping me up however.

As I understand the problem, I need to look for "com" as the start of  
the class path, strip out anything before that and then convert  
subsequent slashes to full stops.
So far I've got as far as


Which as I understand it, matches "com" and then "/[somefoldername]",  
and then repeats the 3rd match pattern ("/[somefoldername]") until  
the end of the path on each path segment.

Am I close? How do I now go about replacing each / with a . in the path?

Thanks for any help!


More information about the textmate mailing list