Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regex to convert URLs to HTML <a href> hyperlinks in Notepad++?

I have a list of URLs in a text file I am trying to change to HTML, but I'm failing miserably.

My URLs are in this format:

http://mydomain.com/here-are-my-links.html

Does anybody know of a regex search/replace command I can run in Notepad++ to change my URL list to this format:

<a href="http://mydomain.com/here-are-my-links.html">here are my links</a>
like image 461
memrat Avatar asked Dec 12 '25 10:12

memrat


1 Answers

Use the regex

(http://mydomain.com/(.*?)\.html)

and replace it with

<a href="\1">\2</a>


If you want to change - into space you can do this

-(?=[^<>]*?</a>)

and replace it with

like image 131
Anirudha Avatar answered Dec 15 '25 04:12

Anirudha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!