SlideShare une entreprise Scribd logo
1  sur  12
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 Kleene, an American
Mathematician.
 Regular expressions are composed of characters,
metacharacters and quantifiers.

3
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
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

match 2

6
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
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
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
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
Questions ?

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

Email:
support@zeteoconsulting.com
Corporate URL:
www.zeteoconsulting.com

Contenu connexe

Tendances

Regular Expressions grep and egrep
Regular Expressions grep and egrepRegular Expressions grep and egrep
Regular Expressions grep and egrep
Tri Truong
 
Intro To Regex In Java
Intro To Regex In JavaIntro To Regex In Java
Intro To Regex In Java
nabeelalimemon
 

Tendances (20)

Regular Expressions in PHP
Regular Expressions in PHPRegular Expressions in PHP
Regular Expressions in PHP
 
Python (regular expression)
Python (regular expression)Python (regular expression)
Python (regular expression)
 
Les08
Les08Les08
Les08
 
Don't Fear the Regex - CapitalCamp/GovDays 2014
Don't Fear the Regex - CapitalCamp/GovDays 2014Don't Fear the Regex - CapitalCamp/GovDays 2014
Don't Fear the Regex - CapitalCamp/GovDays 2014
 
Looking for Patterns
Looking for PatternsLooking for Patterns
Looking for Patterns
 
Regular expressions and php
Regular expressions and phpRegular expressions and php
Regular expressions and php
 
Regular Expressions grep and egrep
Regular Expressions grep and egrepRegular Expressions grep and egrep
Regular Expressions grep and egrep
 
C# p5
C# p5C# p5
C# p5
 
Using Regular Expressions in Grep
Using Regular Expressions in GrepUsing Regular Expressions in Grep
Using Regular Expressions in Grep
 
Problem solving (programming) 5
Problem solving (programming) 5Problem solving (programming) 5
Problem solving (programming) 5
 
Regexp
RegexpRegexp
Regexp
 
Don't Fear the Regex - Northeast PHP 2015
Don't Fear the Regex - Northeast PHP 2015Don't Fear the Regex - Northeast PHP 2015
Don't Fear the Regex - Northeast PHP 2015
 
Perl_Part4
Perl_Part4Perl_Part4
Perl_Part4
 
2.regular expressions
2.regular expressions2.regular expressions
2.regular expressions
 
Don't Fear the Regex WordCamp DC 2017
Don't Fear the Regex WordCamp DC 2017Don't Fear the Regex WordCamp DC 2017
Don't Fear the Regex WordCamp DC 2017
 
Grep
GrepGrep
Grep
 
Python regular expressions
Python regular expressionsPython regular expressions
Python regular expressions
 
Intro To Regex In Java
Intro To Regex In JavaIntro To Regex In Java
Intro To Regex In Java
 
Grep - A powerful search utility
Grep - A powerful search utilityGrep - A powerful search utility
Grep - A powerful search utility
 
Learning Grep
Learning GrepLearning Grep
Learning Grep
 

Similaire à RegEx : Expressions and Parsing Examples

Unit 2 - Regular Expression.pptx
Unit 2 - Regular Expression.pptxUnit 2 - Regular Expression.pptx
Unit 2 - Regular Expression.pptx
mythili213835
 
27.2.9 lab regular expression tutorial
27.2.9 lab   regular expression tutorial27.2.9 lab   regular expression tutorial
27.2.9 lab regular expression tutorial
Freddy Buenaño
 
Regular Expressions and You
Regular Expressions and YouRegular Expressions and You
Regular Expressions and You
James Armes
 

Similaire à RegEx : Expressions and Parsing Examples (20)

RegEx Parsing
RegEx ParsingRegEx Parsing
RegEx Parsing
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular Expressions
 
Regular expressions in Python
Regular expressions in PythonRegular expressions in Python
Regular expressions in Python
 
Regular Expressions 101 Introduction to Regular Expressions
Regular Expressions 101 Introduction to Regular ExpressionsRegular Expressions 101 Introduction to Regular Expressions
Regular Expressions 101 Introduction to Regular Expressions
 
Regular_Expressions.pptx
Regular_Expressions.pptxRegular_Expressions.pptx
Regular_Expressions.pptx
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
Don't Fear the Regex LSP15
Don't Fear the Regex LSP15Don't Fear the Regex LSP15
Don't Fear the Regex LSP15
 
Adv. python regular expression by Rj
Adv. python regular expression by RjAdv. python regular expression by Rj
Adv. python regular expression by Rj
 
Chapter 3: Introduction to Regular Expression
Chapter 3: Introduction to Regular ExpressionChapter 3: Introduction to Regular Expression
Chapter 3: Introduction to Regular Expression
 
Unit 2 - Regular Expression.pptx
Unit 2 - Regular Expression.pptxUnit 2 - Regular Expression.pptx
Unit 2 - Regular Expression.pptx
 
Unit 2 - Regular Expression .pptx
Unit 2 - Regular        Expression .pptxUnit 2 - Regular        Expression .pptx
Unit 2 - Regular Expression .pptx
 
Regular expressions in oracle
Regular expressions in oracleRegular expressions in oracle
Regular expressions in oracle
 
27.2.9 lab regular expression tutorial
27.2.9 lab   regular expression tutorial27.2.9 lab   regular expression tutorial
27.2.9 lab regular expression tutorial
 
Regular Expressions and You
Regular Expressions and YouRegular Expressions and You
Regular Expressions and You
 
Module 3 - Regular Expressions, Dictionaries.pdf
Module 3 - Regular  Expressions,  Dictionaries.pdfModule 3 - Regular  Expressions,  Dictionaries.pdf
Module 3 - Regular Expressions, Dictionaries.pdf
 
Regular Expression Cheat Sheet
Regular Expression Cheat SheetRegular Expression Cheat Sheet
Regular Expression Cheat Sheet
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Php Chapter 4 Training
Php Chapter 4 TrainingPhp Chapter 4 Training
Php Chapter 4 Training
 
Bioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introductionBioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introduction
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Dernier (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

RegEx : Expressions and Parsing Examples

  • 1. RegEx : Expressions and Parsing Examples
  • 2. Overview  What is RegEx  Purpose of RegEx  How it Works  Advantages  Demonstration  Q&A 2
  • 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. 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. How it Works  Regular Expressions: Exact Matches regular expression cks rocks. match is okay. no match 5
  • 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. 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. 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. 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. 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. Questions ? Email Us @ support@zeteoconsulting.com 11
  • 12. Worldwide Offices: USA (Dallas) India (Pune) Partner Offices: Monterrey (Mexico) Frankfurt (Germany) Stockholm (Sweden) Email: support@zeteoconsulting.com Corporate URL: www.zeteoconsulting.com

Notes de l'éditeur

  1. {}