Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a script with lots of lines like this:

ss Get $/%SS_SOURCE_PROJECT%/DLL/Vim25Service2005.dll -I-Y -R -VL%2
ss Get $/%SS_SOURCE_PROJECT%/97AUTO/*.* -I-Y -R -VL%2

We're migrating from one tool to another (VSS -> TFS) and need to port this script. Lines like the former (get individual file) should be transformed to:

tf get . Vim25Service2005.dll /all /version:L%2

While the latter (get a directory recursively) should be transformed to:

tf get 97Auto /all /recursive /version:L%2

Can I automate this with a couple of smart find & replace commands in notepad++, maybe using regex?

share|improve this question

For the first line:

Find: .*\$.*/([^\*]*) *-I *-Y *-R *-V *(.*)

Replace: tf get . $1 /all /version:$2

For the second line:

Find: .*\$.*/\*\.\* *-I *-Y *-R *-V *(.*)

.*\$.*/(.*)/\*\.\* *-I *-Y *-R *-V *(.*)

Replace: tf get . /all /recursive /version:$1

tf get $1 /all /recursive /version:$2

These regexes address possible lack of or extra whitespace between your arguments, but they do expect your arguments to be in the order you specified (i.e. -I, -Y, -R, -V). If your arguments are not always in that order we will have to get a bit more creative.

Tested in Notepad++ 6.3.3

If you need/want to try and tweak it some I recommend using the gskinner regex tool. It is excellent for rapid prototyping regexes.

share|improve this answer
Works great but darn it, I realised I made a mistake in the 2nd one... the "97Auto" needs to be used in the replace text... I guess this means using grouping which is definitely beyond my regex skills! – Mr. Boy Jul 18 '13 at 9:25
I adjusted the second regex for you. When you want to make a group in regex you just use parenthesis then access that group with the $1, $2, ..., $n. – ubiquibacon Jul 18 '13 at 13:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.