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! While you're at it, check out some resources Treehouse students have shared here.
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

Arnold Rosario
16,357 PointsWhat are the brackets for? Ex: [^\\w#@']+, and why is the '+' outside the brackets?
I'm confused on what the brackets are for and why the plus sign is outside the brackets.
1 Answer

Ryan Ruscett
23,309 PointsHola,
Ex: [^\w#@']+
Well the [] represent the container in which my pattern will be defined within. I am searching for a pattern contained within the []. Except I don't just want to match it one time. I want to match it more than once.
So I say search for a patterned defined inside [] and find all occurrences of what is inside the pattern with +
For example: hello, did you know hello is a greeting?
If I want to search for a pattern. I need to define the pattern in which to search for. I do this inside []
[hello]
But there are 2 hello's not just 1. If I want to find all patterns that match. I put + outside the pattern I am searching for
[hello]+
Does that make sense?
Arnold Rosario
16,357 PointsArnold Rosario
16,357 PointsMakes sense, thank you!