May 4, 2012

Regular expressions or Regex or Regexp

Regular Expressions are some patterns describing some amount of text.

Real World Application of Regular Expressions:
Suppose you have a file that contains comma separated employee details like
First name, Last name, Cell no, Salary, address, Email etc.,
1) You want to extract only the Employee name and email-id from that huge list of data.

2) You are looping through the employee details, you just want to pick all the employees info whose salary is greater than 5000$
3) You want to replace all the occurrences of a misspelled employee name
e.g., Grorge to George

And lot more............



Advantages of Regular Expressions:
1) Regular expressions is a part and parcel in Perl.
2) It makes the life easy for a developer or programmer to search/replace a pattern in a line.
3) It saves a lot of time of the developer or programmer


General Topics on Regular Expressions:
1) Search & Replace
2) Start and End of String or Match
3) Word Boundaries etc.,


Advanced Topics on Regular Expressions:
1) Capturing
2) Non-Capturing PAranthesis
3) Look Around Concepts
4) Look Ahead
5) Look Behind
6) Back Tracking
7) Atomic Grouping
8) Possessive Quantifiers etc.,

We will discuss these topics one by one in brief in the coming posts.
Thanks for your valuable time, Have a good day :-)


No comments:

Post a Comment