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

Ruby

jadaml
jadaml
11,593 Points

Testing Profile Name section with: /^[a-ZA-Z0-9_-]+$/, SyntaxError

The text in my editor appears to be exactly what Jason has but I keep getting the following errors when I run the test in the console.

.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require': /Users/Jadam/projects/treebook/app/models/user.rb:23: syntax error, unexpected ':', expecting '}' (SyntaxError)
                       with: /^[a-ZA-Z0-9_-]+$/,
                            ^
 empty range in char class: /^[a-ZA-Z0-9_-]+$/
/treebook/app/models/user.rb:23: syntax error, unexpected ',', expecting '}'
/treebook/app/models/user.rb:25: syntax error, unexpected '\n', expecting =>

(https://teamtreehouse.com/library/programming/build-a-simple-ruby-on-rails-application/building-the-profile-page/testing-the-profile-name)

1 Answer

Julien Gascard
Julien Gascard
12,818 Points

Hi !

Isn't it "/^[a-zA-Z0-9_-]+$/" ? The first "z" must be lowercase imho...