kornisb
kornisb

Reputation: 260

Notepad++ insert into specific part of matched strings

I have a tab separated text file with phone numbers opened in Notepad++. Some numbers have the format:

+36-six additional number-

I would like to change them to:

+3636-six additional number-

\+36\d{6}\t matches these numbers in the middle of the lines

\+36\d{6}$ matches these numbers at the end of the lines

What should I replace them with to do that?

Upvotes: 0

Views: 32

Answers (1)

Aaron
Aaron

Reputation: 24812

You will want to match

\+36(\d{6})

And replace it with

\+3636\1

Where \1 refers to the first (capturing group) of the matching pattern, that is the 6 digits.

If you need to make sure you replace only the numbers in the middle of the lines and end of the lines, use \+36(\d{6})(\t|$) and replace with \+3636\1\2 to preserve the tabulations.

Upvotes: 1

Related Questions