2
I've such kind of strings from the log file
rule family="ipv4" source address="54.246.81.158" reject
rule family="ipv4" source address="175.36.129.24" reject
How can I match an IP address from every of that string and then replace the original one with matched IP using regular expression in Notepad++ text editor?
Expected result:
54.246.81.158
175.36.129.24
I prefer to achieve the goal usig regexp and Search and replace only. If it ever possible in Notepad++ I know that I can use macro functionality, but I don't want to do so.
So, at first, we'll match IP with regexp (\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}
). At second we replace original string with IP from step #1
But I'm not sure if it ever possible using Notepad++.
If I'm failed with this, I'll use vim :-)
If text
rule family="ipv4" source address="
is common in all lines, you can also replace your IP by recording amacro
for one row and executing it till end of file. – Sandeep – 2018-05-10T08:11:24.340It's not really clear what you are trying to achieve, please, edit your question and add more lines and expected result. – Toto – 2018-05-10T08:14:33.943
@Toto, Example added, done. – Twissell – 2018-05-10T11:49:59.750