问题
I have a csv-file, now i need to bring it in another form.
I want to have a line break \r\n after a specific pattern.
All patterns look like this:
true or false; int number between 0 and 100; decimal number with two or three digits after the point; true or false;
For example:
false;2;23.987;false;
true;0;8.37;false;
false;8;166.987;false;
and after the last semicolon, i want to have a line break. I am using notepad++.
Thanks for your help
回答1:
You may use
\b(?:true|false);\d+;\d+\.\d+;(?:true|false);
or a more precise acc. to your specs:
\b(?:true|false);(?:\d{1,2}|100);\d+\.\d{2,3};(?:true|false);
and replace with $0\r\n
.
Details:
\b
- word boundary(?:true|false)
- a non-capturing group matching eithertrue
orfalse
;
- a literal;
(?:\d{1,2}|100)
- either any 1 or 2 digits or100
;
- a semi-colon\d+\.\d{2,3}
- 1+ digits, a literal.
and then 2 or 3 digits;
- a;
(?:true|false)
- again eithertrue
orfalse
;
- finally, the last semi-colon.
来源:https://stackoverflow.com/questions/39972913/add-a-new-line-after-a-matched-pattern-in-notepad