A
A
Alexander2020-11-12 09:22:54
Regular Expressions
Alexander, 2020-11-12 09:22:54

How to make this regular expression for notepad++?

Good morning, guys.

There are lines in Notepad:

11111111111111
2222222222222

33333333333333
44444444444444

55555555555555
66666666666666


etc.

Always 2 lines with numbers/letters/spaces and 1 empty line:
33333333333333
44444444444444
...................... - empty line - let it all be be called "Template"

How to put in each "Template" of the entire txt document, a semicolon character, only 1 line?

Example:
3333333 3333333;
44444444444444

3333 333 3333333;
44444444444444

33 3 3 3333 3333 33;
44444444444444

3 3 3 3 3 3 3 3 3 3 3 3 3 3;
44444444444444


PS Honestly! Searched, tried, sat on regex101. Unfortunately IQ is not enough. Help me please!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2020-11-12
@StupidQuestion

Search for (\d+)\r\n(\d+\r\n\r\n)
Replace with \1;\r\n\2
If there is something else besides numbers, then replace \d with .
Put the last semicolon by hand

S
Sergey Vodakov, 2020-11-12
@WaterSmith

Your task is much easier to formulate:
You need to insert ; at the end of every line following an empty line.
I think this problem can be solved with a macro:
1. Enter ^\R into the search and check the box "Regular expression", uncheck the loop search checkbox.
2. Macros - start recording.
3. End - ; - F3
4. Macros - stop recording
5. Get on the first line. Macros - multiple launch. Execute to the end of the file. Launch
Everything, you will be happy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question