Quantcast
Channel: The Creative Juices Bo. Co. (CJBoCo) RSS 2.0 Feed
Viewing all articles
Browse latest Browse all 130

Validating E-Mail and Web Addresses Using Regular Expressions with ColdFusion (Blog Entry)

$
0
0

Two Useful Form Field Validation Functions

Here are two quick ColdFusion scripts to validate if a user supplied a real e-mail address or website URL using Regular Expressions.

To validate an e-mail address:

<cfif REFindNoCase("^[\w\.-]+@[\w\.-]+\.[a-zA-Z]{2,3}$",form.EMAIL) lt 1>    <--- E-mail address was not valid.... ---></cfif>

... and to validate a website url:

<cfif REFindNoCase("^(http://|https://)[\w\.-]+\.[a-zA-Z]{2,3}(/?)$",form.WEBSITE) lt 1>    <--- Website URL was not valid.... ---></cfif>

I wanted to post these real quick just so I have them handy, but also you might find them useful as well.


Viewing all articles
Browse latest Browse all 130

Trending Articles