How I can convert urls in a text file to clickable links??
-
I have multiple text files having links in seperate lines.
https://example.com/pic1.jpg
https://example.com/pic2.jpg
https://example.com/pic3.jpg
.
.
.I want to make all links clickable and save it with .html extension.
This is what i want to achieve and save as .html
<a href=“https://example.com/pic1.jpg”>https://example.com/pic1.jpg</a>
<a href=“https://example.com/pic2.jpg”>https://example.com/pic2.jpg</a>
<a href=“https://example.com/pic3.jpg”>https://example.com/pic3.jpg</a>This website
Helped me create above html tags
https://www.textfixer.com/html/convert-url-to-html-link.phpBut can Notepad++ do this same on my multiple files?
I have around 40-50 txt files with links. -
Hi @R-k
I assume that the curly quotes in the example data you posted are actually straight quotes (*). If that is the case, then the following regex will convert any line that starts with
http://orhttps://into a clickable link:Search: (?-s)^https?://.+$ Replace: <a href="$0">$0</a>Put the caret at the very beginning of the document, select just the
Regular Expressions modeand click theReplace Allbutton.Take care and have fun!
(*)
Note:When you post data, please highlight the examples and then press the</>button above in order to prevent the website from mangling the data, as did happened in this case with double quotes. -
Hello @r-k and All,
Very easily !
-
Open the Find in Files dialog (
Ctrl + Shift + F)-
SEARCH
^(?-si)http.+$ -
REPLACE
<a href="$0">$0</a> -
Type in
*.txtin the Filters: zone -
Type in the
absolute pathto your40-50text files in the Directory: zone -
Select the
Regular expressionsearch mode
-
-
Click on the
Replace in Filesbutton and valid the confirmation dialog
Et voilà !
IMPORTANT : Before applying this S/R to your set of files, give it a try against ONE test file, only :
-
Open the Replace dialog (
Ctrl + H)-
…
-
…
-
Click once on the
Replace Allbutton or several times on theReplacebutton
-
Best Regards
guy038
P.S. : In fact, @astrosofista just beat me ;-))
-
-
@guy038 OP here! This is exactly what I was looking for. Thank You.