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 Ruby Basics Strings Escape Sequences

Saadia Fattah
Saadia Fattah
1,939 Points

How do you make these escape sequences work?

It keeps on saying Bummer: (eval):3: unterminated regexp meets end of file (eval):3: syntax error, unexpected tSTRING_END, expecting tSTRING_CONTENT or tREGEXP_END or tSTRING_DBEG or tSTRING_DVAR

program.rb
puts  "cats/n"
puts  "cats/t"
puts  /"cats"

2 Answers

Rogier Nitschelm
seal-mask
.a{fill-rule:evenodd;}techdegree
Rogier Nitschelm
iOS Development Techdegree Student 5,461 Points

Hello there,

Two suggestions from me. Remember that an escape sequence uses a backslash:

puts "cats/n" # this does not work unfortunately. 
puts "cats\n" # you should try something like this instead

The same goes for escaping a double quote:

puts /"cats" # this does not work
puts "\"cats"  # this does however

So remember, always use a backslash when escaping \.