Welcome to my ASP Code Website

Regular Expression Pattern Matching



Regular Expressions let you do pattern matching in VBScript and ASP. In essence, you can validate that any input string matches up to your required letter/number settings.

What you can do is specify exactly what characters should be found in each position. So if you wanted to only accept values of

ID1 through ID9, you could set your pattern to be

ID[1-9]

If you needed a value to start with SUBJ but have any characters after that point, you could do

SUBJ*

You can also use {#} to say you want # of something. So you can do

[1-9]{9}

if you want to see 9 digits in a row. So a pattern for a social security number would be

[0-9]{3}-[0-9]{2}-[0-9]{4}

To learn how to use these patterns in your code, be sure to read Using Regular Expressions in ASP Coding!

ASP Basic Concepts