I load validator js from : https://cdnjs.cloudflare.com/ajax/libs/validator/10.9.0/validator.min.js.
and chrome console give error below:
Uncaught SyntaxError: Invalid regular expression: /^[Α-ω]+$/: Range out of order in character class
at validator.min.js:763
at validator.min.js:26
at validator.min.js:27
+1 Got this too. Possible workaround is requiring parts that don't require the lib/alpha.js module. It seems that maybe chrome (including Canary, and Safari for MacOS) also seems to mess up something with the encoding.
In the file @ L13: 'el-GR': /^[Α-ω]+$/i,
In the browser it comes out as: "el-GR":/^[Α-ω]+$/i
No clue what this means, but maybe the characters need to be escaped somehow
I'm also seeing this on Google Chrome Version 71.0.3578.98 (Official Build) (64-bit) on OSX. Tried pretty much every version dating back to 2014 and it's present on all of them. Not sure what's going on there offhand.
I'm also seeing this on Google Chrome Version 74.0.3729.169 (Official Build) (64-bit)
Anybody found a workaround for this?
Ok what worked for me was adding the charset="UTF-8" attribute to my <script> tag in the HTML. I think also you could make your server return the right charset in the content-type response header as well.
Oh yes that's a good point! These regular expressions contain unicode characters and the default charset for most browsers does not support this and it needs to be explicitly set in the template file.
a PR is welcome.
I don't think any action is necessary in terms of the library itself, but maybe some information in the readme to instruct consumers of this library on the web to ensure that they have correctly configured their charset metadata entry on their web page.
Most helpful comment
Ok what worked for me was adding the
charset="UTF-8"attribute to my<script>tag in the HTML. I think also you could make your server return the right charset in thecontent-typeresponse header as well.