Hackerrank Day 28: Regex Patterns & Databases

RegEx (Regulation Expressions)  

This is a 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 level of abstraction to strings that makes it easier to search and manipulate text. While they can seem very confusing at first, the syntax for regular expressions is pretty standard across different programming languages.

This is a good guide for common regex used in Ruby.

screen-shot-2017-01-04-at-1-09-17-pm

Could not solve this problem using RegEx in Ruby and could not find anyone else that did either so I’m frustrated, but I don’t feel too bad.  :/

Solution without RegEx:

screen-shot-2017-01-04-at-1-07-58-pm

Talked to Thomas and he suggested removing the .com and just search of emails that have ‘@gmail’ so we can avoid dealing with the period.  Pretty smart!

Solution with RegEx: 

screen-shot-2017-01-04-at-1-25-08-pm

 

 

 

 

 

Advertisements
Hackerrank Day 28: Regex Patterns & Databases

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s