I have a RegularExpressionValidator on my page that checks email using this
<asp:RegularExpressionValidator ID="valEmailExpression" runat="server" ErrorMessage="Your email address does not appear to be of a valid form. (eg: your.name@yourorganisation.com )" ControlToValidate="txtUsername" EnableClientScript="false" ValidationExpression=**"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"** Display="None"></asp:RegularExpressionValidator>
This works for things like " hello@hello.com "
but if the user cuts and pastes email messages, sometimes you get things like " hello@hello.com " or " hello@hello.com ".
Is it possible to indicate in a regular expression that I would like to trim spaces before checking email?
source share