I want to validate an email address using Spring Decoration of DOJO framework. but the regex which used to work in normal validation is not working.
<script type="text/javascript">
Spring.addDecoration(new Spring.ElementDecoration({
elementId: "emailAddress",
widgetType: "dijit.form.ValidationTextBox",
widgetAttrs:
{
regExp : "/^[\w\.=-]+@[\w\.-]+\.[\w]{2,4}$/",
required:"true",
invalidMessage:"<span class='graytext'>Invalid format for email Address.<br> </span>",
trim:"true"
}
}));
Why is my regExp is not working here in the Spring decoration of DOJO?
^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$
– serv-inc May 25 '15 at 08:57(had a backtick, so formatting cannot be done via backtick)