Skip to content

Instantly share code, notes, and snippets.

View rajeswarivmarimuthu's full-sized avatar

Rajeswari Marimuthu rajeswarivmarimuthu

View GitHub Profile
@rajeswarivmarimuthu
rajeswarivmarimuthu / gist:aacea357125ab9bd3cd80e5be64d3c3c
Last active July 3, 2022 04:13
Sharing My Experimentation with Regex!

Sharing My Experimentation with Regex!

Recently, I have been experimenting with regular expression (fondly called as 'regex') with a goal of understanding it's practical application in day today work. Sharing my learning in this article to help anyone read, understand and write basic constructs of regular expressions and its applications. It can be as simple or complex as we would like! Happy Reading!!

Summary

The example I would like to share is validating names. You might think what big deal in validating names, it is just words with alphabets in it. But when I started implementing, I noticed different attritubes a name can possibly have... to name a few Title (Mr., Mrs., Ms., Dr.), First Name, Middle name, Last name, Special characters (like Hyphens, Apostrophes), Suffix (Jr, Sr, I, IV etc.,). So what we think is simple can get complex based on the perfection we might need.

I'm going to present 2 examples covering different basic patterns.