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 mode
and click theReplace All
button.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
*.txt
in the Filters: zone -
Type in the
absolute path
to your40-50
text files in the Directory: zone -
Select the
Regular expression
search mode
-
-
Click on the
Replace in Files
button 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 All
button or several times on theReplace
button
-
Best Regards
guy038
P.S. : In fact, @astrosofista just beat me ;-))
-
-
@guy038 OP here! This is exactly what I was looking for. Thank You.