![]() |
find and replace links in a large text file
is there a utility, or is it possible with notepad++ or any other of the popular code editors to do a search and replace with wildcards?
eg. say you have a large text file, that is scattered with a bunch of <a href... type of links, but they are all different as far as text and url's, I would like to use a * wildcard to be able to search for all occurences of any type of link and replace it with something else any ideas? |
regexp FTW
|
Quote:
|
Code:
sed 's/old/new/g' input.txt > output.txt |
Quote:
|
wildcard to match any type of link? Sure!
Code:
/a[\s]+[^>]*?href[\s]?=[\s\"\']+(.*?)[\"\']+.*?>([^<]+|.*?)?<\/a>/i |
Quote:
|
edit: not working for some reason, is the code right and I am doing something wrong? using regexp search but not matching
|
download textpad, it works great.
press F8, then use .*. as the wild card. |
The above is Perl Regex, not "universal" regex.
|
Quote:
|
Quote:
|
found the answer:
Code:
<a href="[^"]+">[^<]+</a> thanks for the help, it was interesting, maybe this thread will help someone else too |
All times are GMT -7. The time now is 08:08 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123