Bookmark, copy spesific lines in notpad++
-
Hello, @akram-duna and All,
One possible method would be to use regular expressions !
-
Open the Mark dialog (
Ctrl + M) -
Type in
(?x-s) ^ testxx .+ \R < -+ > \R \K (?s: .+? ) (?= \R ^ < -+ > )in the Find what: zone -
Untick all the box options
-
Click the
3optionsBookmark line,Purge for each searchandWrap around -
Select the
Regular expressionsearch mode -
Click on the
Mark Allbutton -
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 !Best Regards,
guy038
-
-
@guy038
Hi mate thanks for your help but thetestxx:textxx testxx2:testxx2are 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 <------------> -
-
-
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 !
Cheers,
guy038
-
Hi @guy038
I tried it and it mark
Test #1: 0 Test #2: 3 Test #3: 0 Test #1: 0 Test #2: 1 Test #3: 4now how to change it to mark
testxx:textxx testxx2:testxx2 -
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.
----
Useful References
- 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
50and150lines ) which recapitulates all ( or almost all ) the possible cases of your INPUT data :INPUT
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 :
OUTPUT
... ... ...BR
guy038
-
@guy038
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