I just really started learning how to use regex\'s and i am trying to create one to match urls. So far i have:
(http://|https://|www|\\w)+\\.[\\w]{2,4}[^\\s]+
Give this one a try: ^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?$
Note that depending on how you are using it, you might want to remove the ^ and $ from the beginning and end.
Plenty of stuff on the web...
the regex you wrote is a good start, the true power of regex is that it can be very... well... powerful :) there are a lot of differences in the structure of URL that are still considered ok.
consult a Regex Reference to learn more and understand the meaning of all the characters.
and you can check for what the community generates by going to a site like this one
this may be overly complex for what you need but this is a well written regex for URLmatching: ^(((ht|f)tp(s?))\://)?(www.|[a-zA-Z].)[a-zA-Z0-9\-\.]+\.(com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk)(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$
on a side note i use this online Regex Helper to test my regex strings without the need to actually run them from the code.