06-07-2011, 06:58 PM
Hi..
Since you have asked this under Regular expression...We can do as given below...
myReg.Pattern = "[a-z0-9]{2,7}@gmail.com" ' Here i just assumed that before @ we can have 2 min chars and max 7 chars. If u need 'to have only 7 then wirte like {7}
'returns true as no of chars 4
msgbox myReg.Test("test@gmail.com")
'returns false. as 1 char
msgbox myReg.Test("t@gmail.com")
Since you have asked this under Regular expression...We can do as given below...
Code:
Set myReg = New RegExp
myReg.Global = True
myReg.IgnoreCase = True
myReg.Pattern = "[a-z0-9]{2,7}@gmail.com" ' Here i just assumed that before @ we can have 2 min chars and max 7 chars. If u need 'to have only 7 then wirte like {7}
'returns true as no of chars 4
msgbox myReg.Test("test@gmail.com")
'returns false. as 1 char
msgbox myReg.Test("t@gmail.com")