Regular expression change first and last line in all opened files
-
Hello, i just was looking a lot of how to change only first and last line of each opened files in notepad.
Anyone have meaby regex to change first fine of each file and last one?
example - first line :
this is line in my file, all lines are different
this is line in my file, all lines are different
this is line in my file, all lines are different
(…)
this is line in my file, all lines are different
this is line in my file, all lines are differentI want change only first line and last one
-
Ok, i just found working solution how:
-> remove first and last line in one ore more files in notepad, just using this regex:
find: `[^\r\n][\r\n]+(.[\r\n]+)[^\r\n]+[\r\n]*'
change for: \1Check regex and matches new line, it works really fine! :)
Then i just easly can add something in first line with this regex:find what: (.*)
replace with: WHATEVERTEXT\r\n\1Also check new line and regex. And the last one action to add something in the last one line of file:
find: (.*)
replace with: \1PUT HERE ANY TEXT
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