If you are a non-coder, this piece of text might be utterly unreadable to you! But you probably have entered your email in a web form and received a please enter a correct email error (which turned out to be the doings of an inadvertent space in your username)! Behind this seeming sentience is a computer language called Regular Expression, often abbreviated Regex or Regexp, that excels in text matching. The one above basically reads like this:
There are three groups of patterns (in parenthesis) to be matched including an optional one (parenthesis followed by an asterisk). The plus symbol ensures the existence of the preceding pattern. The first group ends with an @ and the escaped dot character (\.) marks the end of the second group, corresponding to the basic structure of an email: email@example.com. So, the first group is essentially your username, it can have alphanumeric characters (upper or lower case letters and numbers) along with dots, underscores and hyphens and no space in between. Second group is your email provider that could also be an alphanumeric string of any length without space but special characters like underscores are not allowed. Third group is the TLD (top-level domain) like .com or .net (2 to 4 letters long) along with a fourth group for second-level domain (upto 2 letters) like .co.uk if applicable. Try it out.
Extracting patterns from a string information is one of the most common tasks in application development and has its uses beyond just a simple find & replace! Now as with any language, the skill lies not in learning but in its implementation. For example, my email regexp recipe will work on normal addresses like firstname.lastname@example.org but corporate mails like email@example.com or the fancier gTLDs like .museum and .travel won’t work.
Apart from needing extensive context specific tweaks, there are also security implications of having a weak generic regex copied from Google. GetRegex will take care of all your text processing needs by creating robust custom regular expressions in one hour flat!
Jorrit Bearends had built and sold several successful online companies before creating GetRegex. He recalls, “On my previous startups, I noticed the rather common problem of building regular expressions for carrying out specific tasks. I wanted to give developers – both newbies and veterans – one more reason to stay focused on the core functionality of their application.” The GetRegex team consists of 50 skilled developers from all over the world, dedicated to delivering regex solutions within an hour.
The company thinks convenience and time savings will be its main appeal. In-house developers are often juggling several roles and being able to off-load parallel yet crucial development tasks like regular expression design can boost productivity and ultimately lead to a more robust application.
Head over to their website and get your regex fix for just $15 dollars!