View Full Version : [solved] a regexp help

27 Apr 2010, 5:34 PM
With the below field definition, the regexp is not matching the email. Any idea why?

var user_email = new Ext.form.TextField({
emptyText: 'Please enter User Email',
fieldLabel: 'User Email',
name: 'user_email',
regex : new RegExp('^[\w.-]{1,}@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]+$'),
regexText: "The email should be [email protected]",
maxLength: 50,
anchor: '94%'

I found the answer to this. The following regex works like a charm