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 trialMICHAEL P
5,191 PointsWhat is the reason to use the gsub method? I am not quite clear on the use of it.
What is the reason to use the gsub method? I am not quite clear on the use of it.
2 Answers
rowend rowend
2,926 PointsIt replaces all the charcaters '-' with empty strings. For example: '1-2-3' becomes '123'.
Marcus Quarles
14,598 PointsHello,
In order to gain a better understanding of the .gsub method you should review the regular expressions concept as a whole. http://www.dotnetperls.com/sub-ruby has nice examples that show what the method does.