SlideShare une entreprise Scribd logo
1  sur  10
Regular Expressions
What are Regular Expressions?
• They are a way of specifying patterns
• Specifically patterns of symbols
  – A set of rules
  – A mini language
  – A tiny, highly specialised programming
    language
• Number one use is for pattern
  matching – ie: finding things
Where could you use this
         awesome skill?
•   Python
•   Perl, C, Java, VB.NET, Javascript
•   Yahoo Widgets
•   Excel, Word ….
Basic RegEx Syntax
[abc] = either a, b or c (class)
a|b = a or b
[a-z] = anything between a and z
[^5] = anything except 5
. = anything (except a new line)
* = multiple instances of the same char (0->)
 The backslash is a metacharacter
(ab)* Round brackets group chars together
                .^$*+?{[]|()
Exercise 1
Which of the following matches regexp a(ab)*a
• abababa
• aaba
• aabbaa
• aba
• aabababa
Exercise 2
•   Which of the following matches regexp abc|xyz
•   abc
•   xyz
•   abc|xyz
Repetitions
• a* = zero or more repetitions of a
• a+ = one or more repetitions of a
• a? = zero or one repetitions of a
  – (in other words, might not be there)
Exercise 3
•   Which of the following matches regexp ab+c?
•   abc
•   ac
•   abbb
•   bbc
Exercise 4
•   Which of the following matches regexp a.[bc]+
•   abc
•   abbbbbbbb
•   azc
•   abcbcbcbc
•   ac
•   asccbbbbcbcccc
Regex Guide

Contenu connexe

Tendances

Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence) Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence) wahab khan
 
Regular Expression (Regex) Fundamentals
Regular Expression (Regex) FundamentalsRegular Expression (Regex) Fundamentals
Regular Expression (Regex) FundamentalsMesut Günes
 
16 Java Regex
16 Java Regex16 Java Regex
16 Java Regexwayn
 
Finaal application on regular expression
Finaal application on regular expressionFinaal application on regular expression
Finaal application on regular expressionGagan019
 
Aaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced conceptsAaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced conceptsAminaRepo
 
Programming in python - Week 3
Programming in python - Week 3Programming in python - Week 3
Programming in python - Week 3Priya Nayak
 
Quick Select (Decrease and Conquer)
Quick Select (Decrease and Conquer) Quick Select (Decrease and Conquer)
Quick Select (Decrease and Conquer) Gem WeBlog
 
Processing data with Python, using standard library modules you (probably) ne...
Processing data with Python, using standard library modules you (probably) ne...Processing data with Python, using standard library modules you (probably) ne...
Processing data with Python, using standard library modules you (probably) ne...gjcross
 
An Introduction to Regular expressions
An Introduction to Regular expressionsAn Introduction to Regular expressions
An Introduction to Regular expressionsYamagata Europe
 
Algorithms Intro Lecture
Algorithms Intro LectureAlgorithms Intro Lecture
Algorithms Intro LectureIra D
 

Tendances (16)

Lisp
LispLisp
Lisp
 
Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence) Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence)
 
(Ai lisp)
(Ai lisp)(Ai lisp)
(Ai lisp)
 
Declarativemagic
DeclarativemagicDeclarativemagic
Declarativemagic
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
Regular Expression (Regex) Fundamentals
Regular Expression (Regex) FundamentalsRegular Expression (Regex) Fundamentals
Regular Expression (Regex) Fundamentals
 
16 Java Regex
16 Java Regex16 Java Regex
16 Java Regex
 
Finaal application on regular expression
Finaal application on regular expressionFinaal application on regular expression
Finaal application on regular expression
 
Aaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced conceptsAaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced concepts
 
Programming in python - Week 3
Programming in python - Week 3Programming in python - Week 3
Programming in python - Week 3
 
Quick Select (Decrease and Conquer)
Quick Select (Decrease and Conquer) Quick Select (Decrease and Conquer)
Quick Select (Decrease and Conquer)
 
Processing data with Python, using standard library modules you (probably) ne...
Processing data with Python, using standard library modules you (probably) ne...Processing data with Python, using standard library modules you (probably) ne...
Processing data with Python, using standard library modules you (probably) ne...
 
An Introduction to Regular expressions
An Introduction to Regular expressionsAn Introduction to Regular expressions
An Introduction to Regular expressions
 
Algorithms Intro Lecture
Algorithms Intro LectureAlgorithms Intro Lecture
Algorithms Intro Lecture
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 

En vedette

Comunicacion y Transmicion de Datos
Comunicacion y Transmicion  de DatosComunicacion y Transmicion  de Datos
Comunicacion y Transmicion de Datosfabiandiazg17
 
Feminism Scholarly presentation
Feminism Scholarly presentationFeminism Scholarly presentation
Feminism Scholarly presentationJackie Kimani
 
McKonly & Asbury Webinar - Mitigating Taxes for Contractors: Section 460 Appl...
McKonly & Asbury Webinar - Mitigating Taxes for Contractors: Section 460 Appl...McKonly & Asbury Webinar - Mitigating Taxes for Contractors: Section 460 Appl...
McKonly & Asbury Webinar - Mitigating Taxes for Contractors: Section 460 Appl...McKonly & Asbury, LLP
 
Eternale Beauty Device
Eternale Beauty DeviceEternale Beauty Device
Eternale Beauty DeviceRudi Velloen
 
La Sociedad De La InformaciëN
La Sociedad De La InformaciëNLa Sociedad De La InformaciëN
La Sociedad De La InformaciëNtonifercaba
 

En vedette (7)

Comunicacion y Transmicion de Datos
Comunicacion y Transmicion  de DatosComunicacion y Transmicion  de Datos
Comunicacion y Transmicion de Datos
 
Feminism Scholarly presentation
Feminism Scholarly presentationFeminism Scholarly presentation
Feminism Scholarly presentation
 
PD:Orienting Teachers to NROC
PD:Orienting Teachers to NROCPD:Orienting Teachers to NROC
PD:Orienting Teachers to NROC
 
The Culture Industry
The  Culture  IndustryThe  Culture  Industry
The Culture Industry
 
McKonly & Asbury Webinar - Mitigating Taxes for Contractors: Section 460 Appl...
McKonly & Asbury Webinar - Mitigating Taxes for Contractors: Section 460 Appl...McKonly & Asbury Webinar - Mitigating Taxes for Contractors: Section 460 Appl...
McKonly & Asbury Webinar - Mitigating Taxes for Contractors: Section 460 Appl...
 
Eternale Beauty Device
Eternale Beauty DeviceEternale Beauty Device
Eternale Beauty Device
 
La Sociedad De La InformaciëN
La Sociedad De La InformaciëNLa Sociedad De La InformaciëN
La Sociedad De La InformaciëN
 

Similaire à Regex Guide

Linear Algebra and Matlab tutorial
Linear Algebra and Matlab tutorialLinear Algebra and Matlab tutorial
Linear Algebra and Matlab tutorialJia-Bin Huang
 
Evaluating Algebraic Expressions presentation PPT.
Evaluating Algebraic Expressions presentation PPT.Evaluating Algebraic Expressions presentation PPT.
Evaluating Algebraic Expressions presentation PPT.RakisaSultan
 
Algebraic Expressions PPT.pptx
Algebraic Expressions PPT.pptxAlgebraic Expressions PPT.pptx
Algebraic Expressions PPT.pptxNardoGunayonFinez
 
Algebraic Expressions PPT.pptx
Algebraic Expressions PPT.pptxAlgebraic Expressions PPT.pptx
Algebraic Expressions PPT.pptxVenusBusalpa1
 
04 Syntax Analysis.pdf
04 Syntax Analysis.pdf04 Syntax Analysis.pdf
04 Syntax Analysis.pdfmovamag594
 
Ruby初級者向けレッスン 48回 ─── Array と Hash
Ruby初級者向けレッスン 48回 ─── Array と HashRuby初級者向けレッスン 48回 ─── Array と Hash
Ruby初級者向けレッスン 48回 ─── Array と Hashhigaki
 
Precalc 8.19.13
Precalc 8.19.13Precalc 8.19.13
Precalc 8.19.13Ron Eick
 
Python advanced 2. regular expression in python
Python advanced 2. regular expression in pythonPython advanced 2. regular expression in python
Python advanced 2. regular expression in pythonJohn(Qiang) Zhang
 
Learn Ruby 2011 - Session 5 - Looking for a Rescue
Learn Ruby 2011 - Session 5 - Looking for a RescueLearn Ruby 2011 - Session 5 - Looking for a Rescue
Learn Ruby 2011 - Session 5 - Looking for a RescueJames Thompson
 

Similaire à Regex Guide (20)

Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Linear Algebra and Matlab tutorial
Linear Algebra and Matlab tutorialLinear Algebra and Matlab tutorial
Linear Algebra and Matlab tutorial
 
Evaluating Algebraic Expressions presentation PPT.
Evaluating Algebraic Expressions presentation PPT.Evaluating Algebraic Expressions presentation PPT.
Evaluating Algebraic Expressions presentation PPT.
 
Algebraic Expressions PPT.pptx
Algebraic Expressions PPT.pptxAlgebraic Expressions PPT.pptx
Algebraic Expressions PPT.pptx
 
Algebraic Expressions PPT.pptx
Algebraic Expressions PPT.pptxAlgebraic Expressions PPT.pptx
Algebraic Expressions PPT.pptx
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Lec3
Lec3Lec3
Lec3
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
04 Syntax Analysis.pdf
04 Syntax Analysis.pdf04 Syntax Analysis.pdf
04 Syntax Analysis.pdf
 
Python - Lecture 7
Python - Lecture 7Python - Lecture 7
Python - Lecture 7
 
Ruby初級者向けレッスン 48回 ─── Array と Hash
Ruby初級者向けレッスン 48回 ─── Array と HashRuby初級者向けレッスン 48回 ─── Array と Hash
Ruby初級者向けレッスン 48回 ─── Array と Hash
 
Precalc 8.19.13
Precalc 8.19.13Precalc 8.19.13
Precalc 8.19.13
 
Erlang
ErlangErlang
Erlang
 
CAP615-Unit1.pptx
CAP615-Unit1.pptxCAP615-Unit1.pptx
CAP615-Unit1.pptx
 
Matlab lec1
Matlab lec1Matlab lec1
Matlab lec1
 
Mit6 094 iap10_lec03
Mit6 094 iap10_lec03Mit6 094 iap10_lec03
Mit6 094 iap10_lec03
 
Python advanced 2. regular expression in python
Python advanced 2. regular expression in pythonPython advanced 2. regular expression in python
Python advanced 2. regular expression in python
 
Learn Ruby 2011 - Session 5 - Looking for a Rescue
Learn Ruby 2011 - Session 5 - Looking for a RescueLearn Ruby 2011 - Session 5 - Looking for a Rescue
Learn Ruby 2011 - Session 5 - Looking for a Rescue
 
Regexes in .NET
Regexes in .NETRegexes in .NET
Regexes in .NET
 

Plus de grahamwell

Excel =if function
Excel =if functionExcel =if function
Excel =if functiongrahamwell
 
Excel Min max-average
Excel Min max-average Excel Min max-average
Excel Min max-average grahamwell
 
What is binary and why do we use it?
What is binary and why do we use it?What is binary and why do we use it?
What is binary and why do we use it?grahamwell
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch developgrahamwell
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch developgrahamwell
 
The software story
The software storyThe software story
The software storygrahamwell
 
Turtle graphics
Turtle graphicsTurtle graphics
Turtle graphicsgrahamwell
 
Database field types
Database field typesDatabase field types
Database field typesgrahamwell
 
Pascal names and types
Pascal names and typesPascal names and types
Pascal names and typesgrahamwell
 
Python part two names and types
Python part two names and typesPython part two names and types
Python part two names and typesgrahamwell
 
Abstraction - Year 9
Abstraction - Year 9Abstraction - Year 9
Abstraction - Year 9grahamwell
 
Thinking about your project
Thinking about your projectThinking about your project
Thinking about your projectgrahamwell
 
The rail fence
The rail fenceThe rail fence
The rail fencegrahamwell
 
Rsa encryption
Rsa encryptionRsa encryption
Rsa encryptiongrahamwell
 
Server side scripts
Server side scriptsServer side scripts
Server side scriptsgrahamwell
 
Revision topic 1 sensors and control
Revision topic 1 sensors and controlRevision topic 1 sensors and control
Revision topic 1 sensors and controlgrahamwell
 

Plus de grahamwell (20)

Pseudocode
PseudocodePseudocode
Pseudocode
 
Excel =if function
Excel =if functionExcel =if function
Excel =if function
 
Excel Min max-average
Excel Min max-average Excel Min max-average
Excel Min max-average
 
What is binary and why do we use it?
What is binary and why do we use it?What is binary and why do we use it?
What is binary and why do we use it?
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch develop
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch develop
 
The software story
The software storyThe software story
The software story
 
Turtle graphics
Turtle graphicsTurtle graphics
Turtle graphics
 
Database field types
Database field typesDatabase field types
Database field types
 
Databases 101
Databases 101Databases 101
Databases 101
 
Kodu controls
Kodu controlsKodu controls
Kodu controls
 
Pascal names and types
Pascal names and typesPascal names and types
Pascal names and types
 
Python part two names and types
Python part two names and typesPython part two names and types
Python part two names and types
 
Abstraction - Year 9
Abstraction - Year 9Abstraction - Year 9
Abstraction - Year 9
 
Thinking about your project
Thinking about your projectThinking about your project
Thinking about your project
 
The rail fence
The rail fenceThe rail fence
The rail fence
 
Lesson 1
Lesson 1Lesson 1
Lesson 1
 
Rsa encryption
Rsa encryptionRsa encryption
Rsa encryption
 
Server side scripts
Server side scriptsServer side scripts
Server side scripts
 
Revision topic 1 sensors and control
Revision topic 1 sensors and controlRevision topic 1 sensors and control
Revision topic 1 sensors and control
 

Dernier

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 

Dernier (20)

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 

Regex Guide

  • 2. What are Regular Expressions? • They are a way of specifying patterns • Specifically patterns of symbols – A set of rules – A mini language – A tiny, highly specialised programming language • Number one use is for pattern matching – ie: finding things
  • 3. Where could you use this awesome skill? • Python • Perl, C, Java, VB.NET, Javascript • Yahoo Widgets • Excel, Word ….
  • 4. Basic RegEx Syntax [abc] = either a, b or c (class) a|b = a or b [a-z] = anything between a and z [^5] = anything except 5 . = anything (except a new line) * = multiple instances of the same char (0->) The backslash is a metacharacter (ab)* Round brackets group chars together .^$*+?{[]|()
  • 5. Exercise 1 Which of the following matches regexp a(ab)*a • abababa • aaba • aabbaa • aba • aabababa
  • 6. Exercise 2 • Which of the following matches regexp abc|xyz • abc • xyz • abc|xyz
  • 7. Repetitions • a* = zero or more repetitions of a • a+ = one or more repetitions of a • a? = zero or one repetitions of a – (in other words, might not be there)
  • 8. Exercise 3 • Which of the following matches regexp ab+c? • abc • ac • abbb • bbc
  • 9. Exercise 4 • Which of the following matches regexp a.[bc]+ • abc • abbbbbbbb • azc • abcbcbcbc • ac • asccbbbbcbcccc