View Full Version : Regex to depricate certain characters in ExtJS Text field

14 Aug 2015, 6:45 AM
Hi All,

I have a text field in which i do not want to allow certain characters like < " ' & > . What should be the regex that i put in?

For example 'ajsdjkhask' must match but not 'asdvh&hsd'.

xtype: 'textfield',
name: 'User1',
fieldLabel: 'User1',
labelWidth: 175,
allowBlank: true,
maxLength: 40,
regex: ???

Thanks in advance

16 Aug 2015, 7:01 PM
regex: /^[^&<>'"]*$/,

I suggest that you also consider using maskRe and stripCharsRe.