FAQ: Learn HTML: Form Validation - Matching a Pattern

This community-built FAQ covers the "Matching a Pattern " exercise from the lesson “Learn HTML: Form Validation”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Introduction to HTML

FAQs on the exercise _Matching a Pattern _

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

25 posts were split to a new topic: What are quantifiers? (the + and {14,16})

6 posts were split to a new topic: Does HTML regex follow the same rules as Javascript?

2 posts were split to a new topic: How to use special characters in regex?

2 posts were split to a new topic: Can this replace minlength and maxlength?

2 posts were split to a new topic: How to enter accented letters?

2 posts were split to a new topic: Why is the type text and not number?

For those having a hard time with regular expressions, I’d recommend https://regexone.com/

It’s an interactive tutorial to teach you the basics of regular expressions. The tutorial could have been better, but it’s more approachable than the overwhelming complete list of regular expressions as in the MDN documentation.


Why are we not using the “+” modifier/identifier in the Credit Card Value regex?? Shouldn’t those numbers also occur one or more times as “+” indicates? Or is it written this way purely because the photo shows each number only used once??

7 posts were split to a new topic: Why is a credit card number using type text?

How would you mandate a certain number of numbers, letters, uppercase letters, or characters in a username or password? For example, “password must include 1 uppercase, 1 lowercase, 1 number, and 1 special character”.

Also, are these patterns something the coder creates? Or is there a set of patterns to follow? How do you build a pattern? This was probably answered in the regex article, I had a hard time following it, super new to coding.

Having the same question. Following if someone replies.

I am eager to start a topic and ask my own questions, but I am not able to. I don’t see any instructions on how to create topics.

This is a great video for understanding regular expressions!

1 Like

I probably just haven’t gotten there yet, but what is the character “+” being used for here? I don’t recall seeing anything on it in previous pages

+ is a quantifier that specifies ‘1 or more’. In other words, at least one.

Quantifiers +, *, ? and {n}