Here's the regex I use for internal emails..

refindnocase("[EMAIL PROTECTED],4}$",email)

This basically says the email has to start with an alpha character,
followed by any alphanumeric value or - or _ or .
Then it has the @
followed by and letter, number or underscore
followed by an '.'
and lastly the domain is between 2-4 characters.
You may want to extend this value to 6.
Plug in some test values and have fun.
As far as phone number..
If it can only be 000-0000 value..
Use
^[\d]{3}-[\d]{4}$

This will match any number exactly 3 times, followed by a dash and
then exactly 4 numbers.
If you want to force the area code use
^[\d]{3}-[\d]{3}-[\d]{4}$

Enjoy



On Thu, 16 Dec 2004 04:14:09 -0400, Simon Smith <[EMAIL PROTECTED]> wrote:
> I use this for all my email validation, its not  regEx but it works OK for me
> 
> function isEmail(str)
> {
> posAtSign = str.indexOf("@")
> posDot =str.lastIndexOf(".")
> end = str.length-1
> start = 0
> missing = -1
> 
> if( str.length == 2)
>        { return false }
> 
> if( posAtSign == missing || posAtSign == start || posAtSign == end )
>        { return false }
> 
> if ( posDot < posAtSign || posDot == missing || posDot == start || posDot == 
> end )
>        { return false }
> 
> return true
> 
> }
> 
> >ok quick ?
> >gunna quit using extensions to do my form validation
> >
> >2 things i need
> >say i have this code
> >
> ><InvalidTag LANGUAGE="JavaScript">
> ><!--
> >function checkForm(){
> >                 theform=document.reg_frm
> >
> >                     // Check member Number
> >                 if (theform.memberN.value==""){
> >                     alert("Please provide your Membership Number, like 
> > 000-0000.")
> >                     theform.memberN.focus()
> >                     return false;
> >                }
> >
> >                    // Check email
> >                if (theform.email.value==""){
> >                    alert("Please provide a Email.")
> >                    theform.email.focus()
> >                    return false;
> >                }
> >
> >
> >
> >how would i add a reg expression for the email
> >and how would i have the memberN in format like 000-0000
> >
> >sorry, i know i was given the code for the 2nd part but now i cant friggin 
> >find it
> >
> >tia
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - RUWebby
http://www.ruwebby.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187868
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to