P
P
Parkovshik2018-08-15 21:07:53
Regular Expressions
Parkovshik, 2018-08-15 21:07:53

How to replace each repeated character in a string with another one?

Hello. Please tell me how to implement this:
There is a database in txt format containing the following expressions:

sampletext1|sampletext2
sampletext1|sampletext2|sampletext3
sampletext1|sampletext2|sampletext3|sampletext4|sampletext5

Etc.
OBJECTIVE: Replace all " | " characters with commas in all strings, except for the very first character.
That is, to end up like this:
sampletext1|sampletext2
sampletext1|sampletext2,sampletext3
sampletext1|sampletext2,sampletext3,sampletext4,sampletext5

I looked for something similar in regular expressions in Notepad ++, but did not find it. Tell me how to implement this through Notepad ++ or in any other way?
PS The base is almost 2 million lines, it is unrealistic to organize it manually. Ready to buy a paid solution.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2018-08-15
@Parkovshik

Is there any character that is not used in strings?
If there is, for example, ~
1. Replacing a regular expression ^([^\|]+)\|=> $1~
2. Replacing |=> ,
3. Replacing ~=>|

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question