1

I want to use Notepad++'s Find/Replace feature to do the following:

Find: Semicolon featured by two digits followed by quotation marks (Example: ;25")

Replace: Replace the semicolon with a colon (Example result: ,25")

What I have so far: I can find what I want (see above) with the following regex: ;[0-9]{2}". However, I am not sure how to properly use the replace function. I know that I can refer with \1 to the matched group, but this does not solve the task.

beta
  • 3,972
  • 10
  • 42
  • 81
  • Possible duplicate of [Reference - What does this regex mean?](https://stackoverflow.com/questions/22937618/reference-what-does-this-regex-mean) – bobble bubble Apr 30 '19 at 13:20

1 Answers1

3

Use a capturing group:

Find what:      ;(\d{2}")
Replace with: ,\1

The \1 is a numeric backreference that holds the value captured by Group 1, and the group is defined with a pair of unescaped parentheses in the pattern.

Settings & demo:

enter image description here

Wiktor Stribiżew
  • 484,719
  • 26
  • 302
  • 397
  • thanks! i will accept as answer. just a quick followup: i work with a large file and notepad++ seems to have issues. shouldn't the same regex work in UltraEdit? – beta Apr 30 '19 at 13:28
  • 1
    @beta Yes, if you set the regex flavor to Perl/PCRE. In the replacement, you may change `\1` to `$1`. – Wiktor Stribiżew Apr 30 '19 at 15:40