Reputation: 65
I have a text field which takes emails, more than one email is separated by comma, so I want a regular expression which will not allow space in that text field i.e the space bar will not work. pls help.. Thanks.
Upvotes: 2
Views: 5260
Reputation: 20419
Don't break the expected user input model. Clean up the input after submission (split on comma then trim each part). Breaking the spacebar will just annoy people.
Upvotes: 1
Reputation: 5920
maskRe: /[^ ]/
[^ ]
means anything except the space character. If you wanted to match all whitespace and not just the space character, use /\S/
Upvotes: 1