I must admit I've never gotten used to using regex, however recently I ran into a problem where the work around would've been more of a pain than using regex. I need to be able to match anything that follows the following pattern at the beginning of a string:
{any_url_safe_word}
+( "/http://"
|| "/https://"
|| "www."
) + {any word}
.
So the following should match:
cars/http://google.com#test
cars/https://google.com#test
cars/www.google.com#test
The follwing shouldn't match:
cars/httdp://google.com#test
cars/http:/google.com#test
What I tried so far is: ^[\w]{1,500}\/[(http\:\/\/)|(https:\/\/])|([www\.])]{0,50}
, but that matches cars/http
from cars/httpd://google.com
.