Share this post

Link to post

Share on other sites

TheDcoder 552

TheDcoder 552

You can make a RegEx (or find it from the internet) for detecting the URLs and append the detected urls with the HTML tags... If you actually do not know how RegEx works, I suggest you to wait for someone else with a magical RegEx pattern to post here, we have a lot of RegEx wizards in the forums

Share this post

Link to post

Share on other sites

mikell 630

mikell 630

This raw example assumes that the links in the text are ending with white spaces. If it is not the case then the pattern must be adapted in the regular expression

Local$text="here is a link https://someurl.org/blahblah in the text, "&@crlf&_"and here is http://otherurl.org/blah another one"$text=StringRegExpReplace($text,'(https?\S+)','<a href="$1">$1</a>')Msgbox(0,"",$text)

Share this post

Link to post

Share on other sites

AlecSadler 5

AlecSadler 5

This raw example assumes that the links in the text are ending with white spaces. If it is not the case then the pattern must be adapted in the regular expression

Local$text="here is a link https://someurl.org/blahblah in the text, "&@crlf&_"and here is http://otherurl.org/blah another one"$text=StringRegExpReplace($text,'(https?\S+)','<a href="$1">$1</a>')Msgbox(0,"",$text)

Thanks, this works perfect for links that are followed by a white-space, but what about raw links sent without any white spaces behind them? How to go about detecting a link when not followed by a space? (how do I detect the end of the link when there's nothing following it)

If it doesn't work then please provide all the precise requirements - may links be enclosed by other characters and which ones
The best would be to post a txt with some examples of the string(s) you have to treat

If it doesn't work then please provide all the precise requirements - may links be enclosed by other characters and which ones
The best would be to post a txt with some examples of the string(s) you have to treat