You are here: PSPad forum > English discussion forum > Re: Reomove all URLs, links in txt file leading to an image?
Posted by: Dirk | Date: 2014-02-24 09:26 | IP: IP Logged
How can I reomove all URLs / links in a text file (and / or better the whole text line which contains this URL / link) which are linking an image (jpg, gif, jpeg, png)?
E.g.: h ttp://domain.com/_OR3829Ik4/399/AAAAAbbAAABZQ/tDpQJm0eW_I/s320/image.jpg
Edited 3 time(s). Last edit at 2014-02-24 09:28 by Dirk.
Posted by: pspad | Date: 2014-02-24 09:45 | IP: IP Logged
modify regilar expression for url's - include image extension on the end of expression and use search/replace dialog and replace it with empty string
Posted by: Dirk | Date: 2014-02-24 10:23 | IP: IP Logged
Thank you.
Unfortunatly I have any idea of those expressions and do not know how to do it. But it means, there is no expression / function (or at least anything extremely similar) available in PSPad doing this by default.
Thanks again.
Posted by: Andreas | Date: 2014-02-24 13:38 | IP: IP Logged
Maybe this way:
search:
.*https?://.*\.(jpeg|jpg|gif|png).*
replace:
[empty]
Not tested.
I think you will get a little help here but if you wanna do such thinks you should search for an online tutorial and regex tester and learn some things.
Posted by: Dirk | Date: 2014-02-24 23:15 | IP: IP Logged
Many thanks Andreas,
Yes, that seems to work very well.
Thanks for the hints, yes actually I should learn about that, but it looks extremely comprehensive. I just tried such a regex tester (http://regex101.com/), it shows two errors obviously, but I could imagine they are not really errors, your regex works great as far as I can see:
/.*https?://.*\.(jpeg|jpg|gif|png).*/
Errors are explained from left to right. Move the mouse cursor over them to see the error highlighted in your pattern
/: Unescaped delimiter
/: Unescaped delimiter
Many thanks again.
Edited 1 time(s). Last edit at 2014-02-24 23:16 by Dirk.
Posted by: Andreas | Date: 2014-02-25 01:49 | IP: IP Logged
In the environment of regex101 they use slashes to surround the regex, so you have to escape the real slashes in your regex with a backslash:
.*https?:\/\/.*\.(jpeg|jpg|gif|png).*
This is a nice one too
regextester.net
And this is a tutorial I've learned from years ago
DE www.regenechsen.de
EN www.regenechsen.de
I'm not a regex specialist just know some basics. I use it in programms like PSPad, File-Search-Tools with PHP and Javascript...
Knowing some basics is not so bad
Edited 1 time(s). Last edit at 2014-02-25 01:49 by Andreas.
Posted by: Dirk | Date: 2014-02-25 09:32 | IP: IP Logged
Yes, knowing some basics is not that bad, there are many circumstances (renaming programs also I assume) you can need those expressions, many thanks for the links. I will have a deeper look at regenechsen, looks very good and understandable.
And many thanks for your regex, Andreas, works fine, for pdf and other files (respectively URLs, links) also.
Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR