Need help to Form validation 3

Hello everyone.

It is advisable to get clarifications on regular expressions. Who can explain why ^_ doesn’t work in the first block [] RegExp
/^[\w^_\d-]+@([\w-^_]+\.)+[\w^_]{2,}$/

A link to the actual task.

In the solution, I applied a range of letters.

Thank you all very much.

Something is starting to clear up. Thus, I expand the range of characters used :rofl:, but the browser itself performs the check after @, ignoring my conditions. So I still need to master the “regexp” to figure out how to exclude a certain character from the range and much more… :face_with_monocle:

In the solution, I left the check only for the first part of the address.

Have a good time of day!

Hi @petrushya

I don’t know if you updated your regex more, but it looks fine to me.
Instead of using a regex for the email I think its better to check if the field is valid (Let the browser check with type="email"). Have you looked into the Constraint validation API. That’s the suggested way to solve this exercise:

We would like you to use the constraint validation API, plus some form validation attributes, to program some custom error messages.

I hope it helps,
Michael

Hello @mikoMK.

Yes, the “regular expression” was changed, but returned to the first value, the partial check does not work quite correctly.

For some reason, I was confused by the length check. After re-viewing “Validating forms using JavaScript” I changed the verification code. I hope that is correct.

Good bye.

Great improvements, @petrushya
This is perfect now. :ok_hand: