If more then 2 line match add match line in front with /
Is there a way so i can run a command example.
If more the 3-4 character match add NAME/ in front of x6128
i have more then 14000 lines so that command will help a lot.
I hope I have read your question well enough to provide a solution. Please let me know if it needs adjustment due to something not shown in the example.
This is a ‘regular expression’, so in the Replace option in Notepad++ copy the red text into each of the 2 fields. Have the wrap around window ticked and regular expression selected, nothing else. If at all unsure of what it will do, run it by clicking the ‘Replace’ button, not the replace all. Once you are comfortable with it you could select the ‘Replace All’ button. My ‘regex’ assumes a carriage return/line feed is immediately behind the text. If this is not the case you will need to provide a more accurate example.
it’s more complicated then that here is a line with more examples, i add a star of lines i have to ***/ add line in front
Well hopefully you can make other regexs using mine as a template. The regex I supplied is fairly simple to understand, the most complicated part is what we call alternation. That’s the 2nd last bracket. Thats where options exist, it has to be one of those character sets. Although I only have 1 character in each, you can have longer strings, I see one of the examples had 2 characters.
Try and give it a go using my regex. We like people to at least try. If you can’t get it to work show us what you have tried.
Casper Rasmussen last edited by
It looks like you pushed find, if so, it did exactly that. What you need to push is the replace button. If the first and possibly a few other hits of the replace button seem to be doing the job hit the replace all button. If will read the rest of the file and change all remaining occurances that fit.
Did you try my regex first and check what that looked like when doing 1 change at a time?
Just remember if at all unhappy with the changes either undo them all or don’t save the file when exiting. Also consider having a backup of the file before making any changes.
Cant make it work even with replace all, just for make a better example what i have to do here is a list of printer ink, and all with a / have been manuel changes, and the command have to do the same job. and thanks for trying to help me :)
the name is the printer same and the / in the ink types for that printer, just so you know what i am doing :)
I took another look at your image. You did not follow my instructions. I said select ‘regular expression’ you did not do that. The regex I supplied needs that to work properly.
Also in your example you should have changed the ‘k’ to ‘kr’ which was one you were looking for. Do a search on the web for ‘regex and alternation’, there are sites that will show good examples.
It’s good you are trying, you just need to follow instructions a bit better.
Scott Sumner last edited by
It’s a lot of WORK, trying to be helpful! :-)