Bookmark, copy spesific lines in notpad++
How can i select or import some specific combos in a txt file notpad++ ,The txt file is like
testxx:textxx <------------> Test #1: 0 Test #2: 3 Test #3: 0 <------------> test1:test1 <------------> ********* <------------> test22:test22 <------------> ********* <------------> testxx2:testxx2 <------------> Test #1: 0 Test #2: 1 Test #3: 4 <------------>
I want to select or copy combos before this suffix
<------------> Test #1: 0 Test #2: 1 Test #3: 4 <------------> Test #1: 0 Test #2: 1 Test #3: 4 <------------>
btw the numbers after Test #1 Test #2 Test #3 are always different
lLike in the example file , i want to import these combos
Hello, @akram-duna and All,
One possible method would be to use regular expressions !
Open the Mark dialog (
Ctrl + M)
(?x-s) ^ testxx .+ \R < -+ > \R \K (?s: .+? ) (?= \R ^ < -+ > )in the Find what: zone
Untick all the box options
Purge for each searchand
Regular expressionsearch mode
Click on the
Click on the
Copy Mark Textbutton
Open a new tab (
Ctrl + N)
Paste the copied text (
Ctrl + V)
Here your are !
Note that any line, made of only four dashes, between your blocks, are generated by the
Copy Marked Textfeature itself !
Hi mate thanks for your help but the
are just examples the origin file contains a lot of different data , that main idea is to copy them using these
<------------> Test #1: 0 Test #2: 1 Test #3: 4 <------------>
Are the blocks to copy contain, at least, two successive lines ?
Or are all the lines to copy begin with the string
the repeated sentence in my file are
<------------> Test #1: Test #2: Test #3: <------------>
Hi, @akram-duna and All,
Could you try this Mark regex ?
(?x-si) < -+ > \R \K (?: Test \x20 .+ \R? )+ (?= \R ^ < -+ > )
Remark : You do not even need to tick the
Bookmark lineoption !
If OK, I’ll explain you how this regex works !
I tried it and it mark
Test #1: 0 Test #2: 3 Test #3: 0 Test #1: 0 Test #2: 1 Test #3: 4
now how to change it to mark
You’re not doing a great job of describing what you want, and you seem to be changing your spec every time you ask the question. Guy has done his best to guess what you mean, and has done a reasonable job; I will usually try to guess, but with your problem desciption, I cannot tell at all what you want (so i cannot offer any suggestions).
Please do a better job of defining your desires, so you get one last answer, and then understand that you are expected to learn from what we share, and figure out how to customize it yourself, and not just expect us to do your homework/job for you.
- Please Read Before Posting
- Template for Search/Replace Questions
- Formatting Forum Posts
- Notepad++ Online User Manual: Searching/Regex
- FAQ: Where to find other regular expressions (regex) documentation
Please note: This Community Forum is not a data transformation service; you should not expect to be able to always say “I have data like X and want it to look like Y” and have us do all the work for you. If you are new to the Forum, and new to regular expressions, we will often give help on the first one or two data-transformation questions, especially if they are well-asked and you show a willingness to learn; and we will point you to the documentation where you can learn how to do the data transformations for yourself in the future. But if you repeatedly ask us to do your work for you, you will find that the patience of usually-helpful Community members wears thin. The best way to learn regular expressions is by experimenting with them yourself, and getting a feel for how they work; having us spoon-feed you the answers without you putting in the effort doesn’t help you in the long term and is uninteresting and annoying for us.
Hello, @akram-duna and All,
Ah… OK ! Of course, you could try that regex :
(?x-si) ^ .+ \R < -+ > \R (?: Test \x20 .+ \R? )+ (?= \R ^ < -+ > )
But the main problem is not solved. We need to know how your present data is organized !
Could you provide us, a reasonable amount of your real text ( I mean, between
150lines ) which recapitulates all ( or almost all ) the possible cases of your INPUT data :
testxx:textxx <------------> Test #1: 0 Test #2: 3 Test #3: 0 <------------> .... .... .... ....
And, starting with that INPUT data, could you show us the OUTPUT text that you expect to :
... ... ...
Thanks a lot your the best I solved my problem with our help, and sorry for my bad description its just about a language issue :D