I want to convert URLS that are in texts such as paragraphs to actual links, but, I want the link output to be just the domain name, for example:
This is a some content about Sitepoint… <-this would be the link instead of it being https://sitepoint.com…
I have been looking all morning for this but cannot find anything that works.
I found codes that convert URLS into links which work, but they show the full URL as the links output, and i do not know regex at all so I have not been able to just output the destination domain name.
Anyone have a solution for this?
If I understand you correctly, you have some text and in that text is a full URL. For example…
“This is some text to https://www.sitepoint.com/some-path/article.html and it is the greatest article on Earth!”
And you want it to find the link in that text and output…
“This is some text to sitepoint.com and it is the greatest article on Earth!”
Here you see only the domain name, but it links to the correct article. Am I understanding this correctly?
Yes, exactly. Though I did manage to solve it already, it wasn’t as complicated as I thought, just at the time of writing this post I couldn’t find any answer to this question.
Please share your solution for the benefit of other users who may have a similar problem.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.