Search and replace Selection (between Begin & End) in multiple files
-
Hello. I have a bunch of files that I want to change. Content that interests me is somewhere in the middle of each file. Let’s say that my text line is between 250 and 370. I just want to keep this text and delete the rest of other lines. Here’s how it looks.
1 <! DOCTYPE html>
2
.250 <p class = “rating”> <img src = “images / test / stars.png” alt = “” /> </ p> ->
.
Word One TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT Last Word
.
370 <div id = ‘AdContainer_mayra_article_End_left_column’> </ div>
.
.
500 </ html>
I have two possibilities that I might ever do.
Option 1. Select everything before Text and delete.
Search and Select BEGIN: “<! DOCTYPE html>”
Search and Select END “<p class =” rating “> <img src =” images / test / stars.png “alt =” “/> </ p> ->”
Replace with 0 (Nothing)The same text after
- Select the entire text version which lies between
Search and Select BEGIN: <p class = “rating”> <img src = “images / test / stars.png” alt = “” /> </ p> ->
and
Search and Select END <div id = ‘AdContainer_mayra_article_End_left_column’> </ div>
DELETE ALL RESTSomeone help me?
-
Hello Neculai,
Your problem should be easily achieved with regular expressions !
However, as I suppose that your two lines 250 and 370, surrounding the text to keep, are different, in each concerned file, I need to know the general pattern of these two lines, in order to build the correct regexes for the S/R !
Thanks you, in advance, for these additional informations !
Best Regards,
guy038
-
Ah, fortunately the RegEx cavalry (a.k.a. @guy038) noticed this thread. I consider the problem solved. ;-)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login