RegEx : Expressions and
Parsing Examples
Overview
 What is RegEx
 Purpose of RegEx
 How it Works
 Advantages
 Demonstration
 Q&A

2
Introduction to RegEx
 RegEx is a sequence of characters for a search to match a
pattern.
 Arose in the 1950 by Stephen ...
Purpose of RegEx
 To match the pieces of text within a larger document.
 To capture the string.
 RegEx is used in PERL,...
How it Works
 Regular Expressions: Exact Matches
regular expression

cks
rocks.
match
is okay.
no match

5
How it Works
 Regular Expressions: Multiple Matches

regular expression

a p p l e

Scrapple from the apple.
match 1

mat...
Metacharacters of RegEx
.

- Matches any single character.

 d - Matches a digit character.
 s - Matches any whitespace...
Metacharacters of RegEx
 abc

- Exactly this sequence of three letters

 [abc]

- Any one of the letters a, b, or c

 [...
Quantifier
Quantifier specify the number of string pattern should
occur in matching string.
*

- Zero or more times.

+
...
Advantages
 The regular expression syntax is declarative: The pattern
"looks like" what you want to match.
 Easily compa...
Questions ?

Email Us @ support@zeteoconsulting.com
11
Worldwide Offices:
USA (Dallas)
India (Pune)
Partner Offices:
Monterrey (Mexico)
Frankfurt (Germany)
Stockholm (Sweden)

E...
Upcoming SlideShare
Loading in...5
×

RegEx : Expressions and Parsing Examples

495

Published on


RegEx is a sequence of characters for a search to match a pattern. Arose in the 1950 by Stephen Kleene, an American Mathematician. Regular expressions are composed of characters, metacharacters and quantifiers.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
495
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • {}
  • RegEx : Expressions and Parsing Examples

    1. 1. RegEx : Expressions and Parsing Examples
    2. 2. Overview  What is RegEx  Purpose of RegEx  How it Works  Advantages  Demonstration  Q&A 2
    3. 3. Introduction to RegEx  RegEx is a sequence of characters for a search to match a pattern.  Arose in the 1950 by Stephen Kleene, an American Mathematician.  Regular expressions are composed of characters, metacharacters and quantifiers. 3
    4. 4. Purpose of RegEx  To match the pieces of text within a larger document.  To capture the string.  RegEx is used in PERL, Java and other programming languages. 4
    5. 5. How it Works  Regular Expressions: Exact Matches regular expression cks rocks. match is okay. no match 5
    6. 6. How it Works  Regular Expressions: Multiple Matches regular expression a p p l e Scrapple from the apple. match 1 match 2 6
    7. 7. Metacharacters of RegEx . - Matches any single character.  d - Matches a digit character.  s - Matches any whitespace character including space, tab, form-feed, etc.  w - Matches any word character including underscore.  n - Matches a newline character. ^ - The beginning of a line $ - The end of a line 7
    8. 8. Metacharacters of RegEx  abc - Exactly this sequence of three letters  [abc] - Any one of the letters a, b, or c  [^abc] - Any character except one of the letters a, b, or c  [a-z] - Any one character from a through z  [a-zA-Z0-9]-Any one letter or digit. 8
    9. 9. Quantifier Quantifier specify the number of string pattern should occur in matching string. * - Zero or more times. + - One or more times. ? - Zero or one time  {m,n} - Matches for atleast m times and atmost n times. 9
    10. 10. Advantages  The regular expression syntax is declarative: The pattern "looks like" what you want to match.  Easily compatible with different programing languages.  Easier for non-programmers than code.  Less error prone than code.  Use in Compiler Construction. 10
    11. 11. Questions ? Email Us @ support@zeteoconsulting.com 11
    12. 12. Worldwide Offices: USA (Dallas) India (Pune) Partner Offices: Monterrey (Mexico) Frankfurt (Germany) Stockholm (Sweden) Email: support@zeteoconsulting.com Corporate URL: www.zeteoconsulting.com
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×