January 26 - Build a URL Parsing Method that Converts Links in Strings into HTML Link Tags
This coding exercise will test your knowledge of how to utilize regular expressions in order to dynamically convert strings in Ruby.
Guide Tasks
- Read Tutorial
- Watch Guide Video
- Complete the Exercise
Video locked
This video is viewable to users with a Bottega Bootcamp license
Already a Bottega Student? Sign In
Summary
Build a method that takes in a string that contains a URL and converts it into an HTML friendly link tag.
Exercise Description
Given the following strings:
"Some content without a link." "Content with a link that has a period after it https://devcamp.com." "https://devcamp.com that starts at the beginning"
Write a program that returns strings with HTML link tags.
Sample Output
"Some content without a link." "Content with a link that has a period after it <a href='https://devcamp.com' target='_blank'>https://devcamp.com</a>." "<a href='https://devcamp.com' target='_blank'>https://devcamp.com</a> that starts at the beginning"
Real World Usage
This is a common skill when it comes to building view helper methods in Rails. This particular exercise will test your ability to work with regular expressions and perform dynamic substitutions in strings.