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 need to update a dateformat in a large file I have in textpad.

the dateformat is currently mm-dd-yyyy and I need to make it mm/dd/yyyy

each line with a date starts with a D.

like this: D02-12-2009

I have my regex search portion working fine ^D(.?)-(.?)-(.*?)?, but the replace is failing when trying to use $1 $2 $3 for my values D$1/$2/$3. It's replacing with the literal $1, $2, and $3. I have set textpad to use POSIX regex.

Any ideas how to capture the values and put them into my replace portion?

share|improve this question

migrated from Dec 17 '09 at 17:11

This question came from our site for professional and enthusiast programmers.

Please use \1 \2 \3 instead of $1 $2 $3

Find What: D([0-9]+)-([0-9]+)-([0-9]+)

Replace With: D\1/\2/\3





Regarding Grouping

Groups a tagged expression to use in replacement expressions. An RE can have up to 9 tagged expressions, numbered according to their order in the RE. The corresponding replacement expression is \x, for x in the range 1-9. Example: If ([a-z]+) ([a-z]+) matches "way wrong", \2 \1 would replace it with "wrong way".

PS:I have no idea why this is moved to here, I had to come here for the first time. :-)

share|improve this answer
I couldn't get \1 to work in TextPad 7.0.9 only $1 would work and only if there's two or more groups. Otherwise I had to use $&. yuck – Conrad Frix Sep 12 '13 at 21:00

"each line with a date starts with a D." I would for extra safety add "^" to the find expression: **^**D([0-9]+)-([0-9]+)-([0-9]+).
Not very likely that the string would occur somewhere else, but...

share|improve this answer

Your Answer


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