I have a JavaScript RegEx rule to match url. When the rule is matching, I convert the string to a link element.
This is my RegEx rule:
/^(((http(s)?|(ftp(s)?)):\/\/)(www\.)?([a-zA-Z0-9][a-zA-Z0-9\.\/-]+[a-zA-Z0-9]\.[^\s]{2,})+(\:[0-9]{5})?|(mailto:){1}([\w\.]+)\@{1}[\w]+\.[\w]{2,})\s$/gm;
When I start typing for example https://www.google.com and hit space at the end, the typed in string matches the RegEx rule and my convert logic happens.
But when I type a different string before it like this: hello world https://www.google.com and hit space, there is no match. How can I change the RegEx rule, so that it also matches the string when other strings are written before it.
