How to find and select all words between select words?
I have been using the “media Companion” to find cover art for my movies as well as plots for the movies as well. I don’t use media programs I just use “Windows 10” and “File Explorer”. So I change the cover art and then I write the plot in the comments section and I also add the Genre.
So here is the issue when I open the notepad++ program to find the “Plot” and the “Genres” the plot starts with <plot> and then the plot is written in there and then it says </plot> is there a way to select all the text between <plot> and </plot> automatically. Because sometimes the text is pretty long and hard to copy by just scrolling over it and highlighting it. I already know how to use the replace from the search. But I’m not to sure if this is even possible. I so please tell me know thank you.
Terry R last edited by Terry R
is there a way to select all the text between <plot> and </plot> automatically
There is a method, it involves using “regular expressions”, or regex for short.
So once the file is opened in Notepad++, use the Find function. Set search mode to regular expression and use the following.
click on the Find Next button. The text you want is highlighted.
If you need an explanation of the syntax of the regex:
(?s)… Identifies any DOT character as also containing the line feed characters (\r and \n)
(?<=plot>)… This positions the cursor so the preceding characters are
(.+?)… This means grab characters lazily until … (The DOT character means any character)
(?=</plot>)… we see immediately ahead of us the
This did the trick and I was wondering if there was a way to select it and not just highlight it. I do see it all grayed out but I was wondering if there is a easier way then to Hold Shift and then Left Click the text I want to select.
Terry R last edited by Terry R
I do see it all grayed out but I was wondering if there is a easier way then to Hold Shift and then Left Click the text I want to select.
Sorry, I don’t know if you mean this to be a new question or follow on from previous.
So once it is highlighted close the Find window and then press Ctrl-C (this will pickup the highlighted text). Go to a new tab or file and position the cursor before Ctrl-V (paste).
Understand it will retain the line formatting as previous, so if multiple lines in the original, then the copy will look exactly the same with indents, line feeds etc.
Okay now finding the “Plot” area is much easier then before and I didn’t know that once the text was highlighted I didn’t need to re-highlight it again once I found the text.
I have been using Ctrl+c and Ctrl+v for a while now I just thought I need to re-select it and then copy it and then paste it. But knowing that by finding it its already highlighted and selected for me. Once I actually copy it with Ctrl+c it gets much easier.
thank you for all the help with this. Now all I need to do is copy the shortcut you gave me and place it into a file and keep it onto my desktop. Do you know of any other tips like this one. Or of a site with tutorials so I can take some tips and place them into a file and keep it on my PC. So I could have some tips at my finger tips so to speak.
Terry R last edited by
Do you know of any other tips like this one.
Well most of the members who have used Notepad++ (often shortened to NPP) for a while will have methods that they use to help them. Unfortunately there isn’t a repository of these that I’m aware of.
But if you have an issue I would suggest searching on this forum first. If you can’t find an answer just post your question. Most of the members will willingly provide their ideas (and solutions) if they think it will help, as I did.
There is an online manual for NPP and references to regular expressions in the FAQ section, so look there as well.
guy038 last edited by guy038
May be, I misunderstand something obvious, but there is an easy way to get a list of all the
<plot>•••••</plot>, at once, in a new file :
Open the Mark dialog (
Ctrl + M)
Tick the two options
Purge for each searchand
Un-tick all other box options
Regular expressionsearch mode
Click on the
<plot>•••••</plot>areas shouild be hightlighted in red !
Now, click on the
Copy Marked Textbutton
Open a new file (
Ctrl + N)
Paste the clipboard contents (
Ctrl + V)
In addition, as you’re currently doing a multi-lines regex search, the
Copy Marked Textfeature automatically inserts a four-dashes separation line (
----) between each occurrence ;-))
Terry R last edited by
easy way to get a list of all the <plot>•••••</plot>
I interpreted the OP’s request as only 1 instance of the text to be selected in the file.
Alan Kilborn last edited by
Now all I need to do is copy the shortcut you gave me and place it into a file and keep it onto my desktop
Instead of that you could make a macro out of it.
- set up your search but don’t execute it yet (or execute it to test it!)
- leave Find window open
- do Macro menu then Start Recording
- now execute the search you’ve previously set up
- do Macro menu then Stop Recording
- do Macro menu then Save Currently Recorded Macro… and name your macro
Now the name you gave the macro will appear in the lower part of the Macro menu, and you can execute it by selecting it.
@Alan-Kilborn The Macro trick worked great thank you. Its like a way to cheat and still not need to re-paste the code every time I change the “Search”. Thank You!