Search  |  Contact  |  Site Map  |  Print
FastVirtual Web Hosting & Internet Services Customer Care  
Web Hosting  |  Domain Names  |  Web Site Builder  |  Internet Access  |  Support Center  |  About FastVirtual

Regular Expressions

Validate form input using
regular expressions.

FormCGI enables you to validate form input using regular expressions.

With this advanced parameter enabled, you can provide qualified regular expressions that need to be matched before the form is processed. If the user attempts to submit the form without meeting your validation requirements, an error message is displayed identifying the failure, together with a link back to the form.

Enabling the Regular Expression Parameter

Regular expression matching is enabled by using the "re" parameter as follows:

     <INPUT TYPE="hidden" NAME="re" VALUE="field1=re1::field2=re2::etc.">

For example, if you wanted to ensure that the "zip_code" field contained only digits, and was exactly 5 characters long, you could use the following regular expression:

     <INPUT TYPE="hidden" NAME="re" VALUE="zip_code=\d{5}">

Or if you wanted to check that the "email" field was a correctly formatted email address, you could use the following regular expression:

     <INPUT TYPE="hidden" NAME="re"
     VALUE="email=^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$">

You can include multiple fields in the same value string by separating them with "::". For example, to check the "zip_code" and "email" fields as above, enter this as follows:

     <INPUT TYPE="hidden" NAME="re"
     VALUE="zip_code=\d{5}::email=^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$">

Find Out More

Due to the numerous complexities involved in using regular expressions, FastVirtual does not provide technical support for this feature. If you wish to find out more about regular expressions, extensive documentation is available from the Perl web site.

 

Web Hosting  |  Domain Names  |  Web Site Builder  |  Internet Access  |  Support Center  |  About FastVirtual  |  Articles  |  Search  |  Contact  |  Site Map
Top of Page FastVirtual, Inc. All Rights Reserved.  Privacy Policy  |  Web Site Usage Terms  |  General Service Agreement