RegEx : A Match so good
Ever wondered how web sites identify if you have entered an email address in the correct format? I certainly have and here’s what I found.
Websites/portals that identify these patterns harness the power of an engine called the Regular Expression Engine. The next question in your mind would be, what is a regular expression? A Regular Expression (often contracted as regex or regexp), in the simplest of terms, is a set of semantics for pattern recognition. A Regular Expression Engine is one that is capable of understanding these semantics and returning the desired output.
Okay, but why define a whole engine and a new semantic set for this simple task?
Though Regular Expressions may seem very fundamental now but when used in the right manner can unleash great potential. Regex was developed in the 1950’s by American mathematician Stephen Kleene. What started out as a way of expressing algebra of regular sets, is now being used in the search operations performed daily on Google, Bing, DuckDuckGo etc. Today regex is used in almost every domain for matching password conditions, checking if emails are entered in correct format, find and replace functions, date validation. Imagine navigating to a particular section of a very long document, without the find function of your text editor. That’s how important regular expressions have become in our life.