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 trialSteven Lacks
18,214 PointsStudent note about error multiline anchors (^ or $)
If you are using a different version of Ruby/Rails and getting the error
"The provided regular expression is using multiline anchors (^ or $), which may present a security risk. Did you mean to use \A and \z, or forgot to add the :multiline => true option?"
You've probably plugged it in and it didn't work. the fix is to add * before \z, *\z.
Of course, if you got this far with a different version, then you probably don't need my help with regEx... but some people seem to hate regEx so I thought I'd share.
Why was this changed? I'm guessing it had to do with new line characters being an issue in validations. \A...*\z doesn't stop when it reaches a new line character, while ^ ...+$ does.
Basically, validating for \A...*\z tests as a string, while ^ +$ tests it as a line. Additionally, if you want to test as a string but stop at the end of a line, there's a way to do that too, but I don't want to confuse myself anymore than I already am.