angularjs - Why does this regex work in angular 1 and not in angular 2? -


why regex in angular 1, given as:

ng-pattern="/(([\u0030-\u0039\u0041-\u005a\u0061-\u007a\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u01bf].*){2,})|^[\u0030-\u0039\u0041-\u005a\u0061-\u007a\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u01bf]{1}$/" 

validates correctly ..ba

but translated angular 2 code not.

validators.pattern("/(([\u0030-\u0039\u0041-\u005a\u0061-\u007a\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u01bf].*){2,})|^[\u0030-\u0039\u0041-\u005a\u0061-\u007a\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u01bf]{1}$/") 

... having slashes removed:

validators.pattern("(([\u0030-\u0039\u0041-\u005a\u0061-\u007a\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u01bf].*){2,})|^[\u0030-\u0039\u0041-\u005a\u0061-\u007a\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u01bf]{1}$") 

i appreciate help.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -