E
E
Eugene2019-07-23 12:03:08
Regular Expressions
Eugene, 2019-07-23 12:03:08

Replacing character with text with regular expression (Notepad++)?

Hello!
I have many, many lines like this:

01.01.2019 $ABVG Z XY Z-XY.AB00.Y.123456/19 | Grounds No. 1,2,3,4 dated 01.01.0001 issued by Company X

I want to change them to this:
01/01/2019 $ABCZ Z XY Z-XY.AB00.Y.123456/19|Ground No.
1
XY Y-XY.AB00.Y.123456/19 | Ground No. 3
01.01.2019 $ABVG Z XY Y-XY.AB00.Y.123456/19 | Ground No. 4 dated 01.01.0001 issued by Company X

Or, if possible :
01.01.2019 $ABVG Z XY Z-XY.AB00.Ya.123456/19|Ground No. 1 dated 01.01.0001 issued to Company
X 2 dated 01.01.0001 issued to Company X on
01.01.2019 $ABVG Z XY Я-XY.AB00.Y.123456/19|Reason No. 3 dated 01.01.0001 issued to Company X on
01.01.2019 $ABVG Z XY Я-XY.AB00. Ya.123456/19|Reason No. 4 dated 01.01.0001 issued by Company X

If I just replace " , " with, for example, " \nBase " , then the first option is almost ready, but I can't manage to save the document number.
This option: Find " (^.*\|), " Replace " \n\1Base # " doesn't want to work at all.
Some "constants":
The document number always starts on a new line and always comes before " | ".
Bases can have a different form - from simple digits to complex alphanumerics with symbols, but are always separated by a comma and located between "#" and "from".
The number of Bases ranges from two to a couple of tens.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2019-07-23
@saboteur_kiev

No, what you want is not decided by the regex.
You need a script because you need a loop to multiply one line into four according to the specified rules.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question