Closed buren closed 7 years ago
Will use.
Also to be consitent the api should use the same regex as that new validator so they complain about the same things:
const EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[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])?)*$/;
@buren
Yeah, that would be great 👍 Now its just a matter of figuring out how to convert that JS-regex into a Ruby one without altering the meaning and I'm no pro-regexer 😉
Took a stab at just changing the start- and end-syntax, but ended up with this error:
irb(main):003:0> EMAIL_REGEXP = /\A(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[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])?)*\Z/i
SyntaxError: (irb):3: premature end of char-class: /\A(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/
(irb):3: syntax error, unexpected tINTEGER, expecting end-of-input
...,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&...
... ^
from /usr/bin/irb:12:in `<main>'
bleh. Why so many conventions.......... kill me pls
Yeah, there are quite a few Ruby to JavaScript regex converters, but not the other way way around 😕
Ng4 now has a email directive/validator