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 trialNikita Serditov
Python Web Development Techdegree Student 2,812 PointsERROR: illegal escape character
When I type:
java> description.split("[^\w#@']+");
I get:
ERROR: illegal escape character
description.split("[^\w#@']+");;
Previously I had a bash syntax error. Why it does not work like on the video?
2 Answers
Craig Garner
25,732 PointsLook in the comments right under the video. He explains the need to use \
Brendon Butler
4,254 PointsSince you have a "\w" in your string, it thinks that you want to use "\w" as an escape character, sort of like "\n" to create a new line. Since there is no "\w" escape character, it doesn't know what to do. To fix this, you'll need to add another "\" before your "\w." That would look something like this:
description.split("[^\\w#@']+");