Recently I am doing my 30-days-code challenge on HackerRank and came across this topic again. I wanted to share here what I have learned about so far.
I have a love-hate relationship with Regexp aka Regular expressions. My friends around me are either hate it or love it. My first thought before this was - wow, this is nice, no crazy functions, loops....but wait, the syntax, symbols are like crazy?
This is a compact syntax means of describing a set of strings using a subset of common characteristics. For example, the common characteristics of aaa, aba, and aca are that they all start and end with the letter a.
Regular expressions add a layer of abstraction to strings that make it easier to search and manipulate text. While they can seem very confusing at first, however, the syntax for regular expressions is pretty standard across different programming languages.
For Data validation and Data extraction. Just like taking the information you wanted from a HUGE excel file. Regex reduces the pain to search a piece of data one by one from the databases. Pretty cool, huh
Regular Expressions are class citizens in Ruby. They have their own class, which comes with its own built-in methods like
Here are some tools for using Regexp.
Happy Regexing! 🚀