Gsub with regex
📖 Scenario: You are working on a text editor feature that needs to clean up user input by replacing certain patterns in a string.
🎯 Goal: Learn how to use Ruby's gsub method with regular expressions to find and replace parts of a text.
📋 What You'll Learn
Create a string variable with a specific sentence.
Create a regular expression pattern to find all vowels.
Use
gsub with the regex to replace vowels with a star *.Print the modified string.
💡 Why This Matters
🌍 Real World
Text editors and input sanitizers often need to find and replace patterns in text, like removing vowels or masking sensitive data.
💼 Career
Understanding how to use regular expressions with string replacement is a valuable skill for software developers working on data cleaning, text processing, and user input validation.
Progress0 / 4 steps