The basic idea is that you can use these expressions in your code to search a bit of text for a particular pattern.A complete discussion of regular-expression syntax is beyond the scope of this article. I'll show you just enough tricks to get started here.The engine also doesn't treat spaces as special characters.If you want to handle spaces, you should code the logic into your regular expressions. To facilitate form validation, I decided to write a function that would accept a field name, an error message, and any number of regular expressions.In Perl, the statement might look like: characters are special symbols that tell the regular expression to look for a single digit.There are four of them because we want the statement to test whether there are four digits in a row in the text within the variable.One way to get around some of these limitations is to use regular expressions.If you're familiar with Unix or Perl, or formal mathematics, you've probably used regular expressions to specify and look for patterns.
With this method, you can restrict all the textboxes in a form.A regular expression might be as simple as in your code won't do anything, but using the expression in a code statement is very powerful.Let's say you want to test whether a particular text string had a four-digit year in it (like 2000).I'll show you later how to query the engine for segment information.What if you want to look for a parenthesis in a text string? If you want to look for a backslash, you'll need two backslashes in a regular expression to make one literal backslash.