Skill Test: Form Validation 2

Hi there :smiley: Hope all well. Kindly asking for assessment for my markup for the second skill test in this series. Codepen here.

Thank you in advance :+1:

Hi again @Phil_G

General notes:

  • You don’t need ^ and $ to denote start and end. These are implied in the pattern attribute.
  • The parentheses in the first two patterns and the second pair in the third pattern can be removed.

Pattern 1: The following two strings match your pattern, but are not allowed by the task description: a.BCDE / a.bc How could you improve your pattern to exclude them?
Pattern 2: This one is fine, but you don’t need to escape the @ (only the .)
Pattern 3: I guess you deliberately allow more formats than asked for. For example 1 (222)333-3333 shouldn’t be possible. Be aware that \s not only matches a space but all of these characters: [\f\n\r\t\v\u0020\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]. You’re also missing . as a separator.

Michael

Hi @mikoMK

Valuable feedback as per usual! Thank you for the review.

RegEx definitely a weakness to improve on so I’m not surprised this submission was lacking.

I will have a closer look at your points and update the code with improvements. Will @ when done if you can spare a few secs to review again?

All the best,
Phil

1 Like

Yeah, regexes are hard, but very powerful and interesting, once you’re starting to get them.

Sure! I’m eager to have a second look. :slightly_smiling_face: