regex - Regular expression in angular gives unmatched parenthesis error -


i trying validate email in angular using regular expression pattern http://www.regular-expressions.info/email.html follows:

input.form-control(type="email", placeholder="email", name="email", ng-model='doctor.email', ng-pattern='[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?') 

which gives error:

    error: /home/pravin/zyoba/nimbus/nimbus-web/views/adddoc.jade:50         48|               .form-group.clearfix         49|                 .col-xs-7       > 50|                   input.form-control(type="email", placeholder="email", name="email", ng-model='doctor.email', ng-pattern='[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?')         51|                 span.font-red.font-23 *          52|                 span.icon-form-cross(ng-show="docregform.email.$dirty &&  validation.test(docregform.email.$error)")         53|       start character ( not match end character ]         @ object.lexer.bracketexpression (/home/pravin/zyoba/nimbus/nimbus-web/node_modules/jade/lib/lexer.js:130:46)         @ object.lexer.attrs (/home/pravin/zyoba/nimbus/nimbus-web/node_modules/jade/lib/lexer.js:581:24)         @ object.lexer.next (/home/pravin/zyoba/nimbus/nimbus-web/node_modules/jade/lib/lexer.js:867:15)         @ object.lexer.lookahead (/home/pravin/zyoba/nimbus/nimbus-web/node_modules/jade/lib/lexer.js:113:46)         @ parser.lookahead (/home/pravin/zyoba/nimbus/nimbus-web/node_modules/jade/lib/parser.js:100:23)         @ parser.peek (/home/pravin/zyoba/nimbus/nimbus-web/node_modules/jade/lib/parser.js:77:17)         @ parser.tag (/home/pravin/zyoba/nimbus/nimbus-web/node_modules/jade/lib/parser.js:733:22)         @ parser.parsetag (/home/pravin/zyoba/nimbus/nimbus-web/node_modules/jade/lib/parser.js:719:17)         @ parser.parseexpr (/home/pravin/zyoba/nimbus/nimbus-web/node_modules/jade/lib/parser.js:188:21)         @ parser.block (/home/pravin/zyoba/nimbus/nimbus-web/node_modules/jade/lib/parser.js:689:25) 

i regular expression noob, , dont know complex regular expressions. please me debug error.

your problem have single quote (') inside regex, delimit start , end of regex string.

you need escape inner quote somehow.


Comments

Popular posts from this blog

javascript - Wordpress slider, not displayed 100% width -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -