To demonstrate the basic idea, let's use a regex that's provided "in the box" with Visual Studio.NET: URL Validation. To create this app, select ASP.NET Web Application from the New Project menu in Visual Studio.NET. Add a TextBox and a RegularExpressionValidator. In the Properties of the RegularExpressionValidator, change the ControlToValidate to the name of the TextBox, and select Internet URL from the "Regular Expresson Editor" window that pops up when you click the three dots at the left side of the ValidationExpression property.
When you click the "run" icon, this simple application will automatically check whether anything entered into the Textbox is a valid URL,
The actual regex inserted into the property is:
http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?
If you haven't coded a regex before, something like this looks like "magic hieroglyphics" and can lead to banging your head against a wall. We'll create an easier one later and you can return to this one and see if it makes more sense to you then.


