[TxMt] Class path generation with regexp

Allan Odgaard throw-away-1 at macromates.com
Fri Nov 3 22:31:39 UTC 2006

On 3. Nov 2006, at 13:15, Sam Thorne wrote:

> [...]
> My limited grasp of regexp is tripping me up however.

What command are you using for this? sed?

> 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
> 	(.+)(com)(.\w+)\3*
> 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.

\3 is a literal match for what the third group captured. In your  
case, you probably just want:


That will put everything after com (which starts with a slash) into  
capture #2.

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

You’d need a second regexp replace for that.

More information about the textmate mailing list