.NET Framework Bookmark and Share   
 index > Regular Expressions > URL Validation help
 

URL Validation help

I'm using the following regex to validate URLs from Javascript. However, I need to be able to accept urls like "google.com" without a prefix.

The regex I'm using is:^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$

I know this is kind of a "send me the codez" post and I apoligize in advance.
SaraJo
^(?:[A-Za-z]+://)?[A-Za-z0-9-_]+\.[A-Za-z0-9-_%&\?\/.=]+$
John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.com
JohnGrove

You can use google to search for other answers

Custom Search

More Threads

• Filtering in a Datatable
• Unspecified group count for substitution patterns
• regex replace is not working <span style="mso-bookmark: OLE_LINK1">
• Regex to extract/parse phone numbers from sites
• question about the regular expression in C#
• Correction with a regular expression
• Get the word that contain the match
• Translate operator
• Match characters and capture
• Regex group