Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
921 views
in Technique[技术] by (71.8m points)

regex - Add a new line after a matched pattern in Notepad++

I have a csv-file, now i need to bring it in another form.

I want to have a line break 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You may use

(?:true|false);d+;d+.d+;(?:true|false);

or a more precise acc. to your specs:

(?:true|false);(?:d{1,2}|100);d+.d{2,3};(?:true|false);

and replace with $0 .

Details:

  • - word boundary
  • (?:true|false) - a non-capturing group matching either true or false
  • ; - a literal ;
  • (?:d{1,2}|100) - either any 1 or 2 digits or 100
  • ; - a semi-colon
  • d+.d{2,3} - 1+ digits, a literal . and then 2 or 3 digits
  • ; - a ;
  • (?:true|false) - again either true or false
  • ; - finally, the last semi-colon.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...