Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
My solution for this practice
Here is my solution:
- Exclude "a" and whitespace, and match one or more alphanumeric characters:
- Match 5 numbers:
- Match commas:
- Exclude "<", ">", "/" and whitespace and match one or more alphanumeric characters:
I hope this helps!
The examples are pretty vague, but the first one is not clear if you should not match the letter 'a' or not match something that has consecutive letters. I honestly couldn't figure out how to do it generically for multiples of any letter.
For 2 and 3, I think they were looking for a different answer, as the lesson was on excluding characters, so for number 2 I would have went with something like
\d+[^\w]*$. For number 3 I might have gone with something like
[^a-z]*, which seems unnecessary, since yours does pretty much the same thing, ultimately excludes everything except the comma.
It's not clear on number 4 if they also wanted you to exclude the slashes.