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 trialvikas pal
11,563 Pointswhat the difference?
Please see the video first before giving the answer .In the video he uses this '^' and this'$' .So what difference it make in the code and the output in the shell is still same nothing is different.so why we used it and using multiline flag no difference is found in the output and please also tell me what \t do.
vikas pal
11,563 Points1 Answer
Ken Alger
Treehouse TeacherVikas;
These symbols, ^
and $
are anchors, or atomic zero-width assertions, and specify a position in the string where a match much occur.
The ^
anchor indicates that the match must occur at the beginning of the string or line. While the $
anchor indicates that the match must occur at the end of the string or line, or before \n at the end of the string or line.
For example, ^\d{3}
will match "901" in "901-331-" since it starts at the beginning of the string, while \d{3}$
would match "331" in the same string since it matches at the end of the string.
Hope that helps and happy coding,
Ken
vikas pal
11,563 Pointsthank you so much you easily cleared by doubts.i send a message to you on twitter.please start talk to me so i can ask question from you and easily get my answers.Ken Alger
vikas pal
11,563 Pointsvikas pal
11,563 PointsKenneth Love