I need to retrieve those URls from a string using regex in JavaScript
Here is an example string:
"Hello everyone! please join us at: https://oursite.com/. and
please visit our courses websites: http://courseone.com.eu & http://coursetwo.us.
For prod use websocket with this url: wss://localhost:4500/websocket/. and
for staging use this url: ws://localhost:4500/websocket".
Now I want to extract these URls from the above string:
Like this:
https://oursite.com/
http://courseone.com.eu
http://coursetwo.us
wss://localhost:4500/websocket/
ws://localhost:4500/websocket
Now I followed this regex given in Detect URLs in text with JavaScript
/(https?:\/\/[^\s]+)/g;
But it is not properly working for me since I have wss and ws URls aswell
Can anyone help me with the regex?