SlideShare a Scribd company logo
REGULAR EXPRESSION IN
ACTION
Brief overview of Regular Expression building blocks and
tools with a practical example
REGULAR EXPRESSIONS PROVIDE A CONCISE AND FLEXIBLE MEANS FOR MATCHING STRINGS OF
TEXT, SUCH AS PARTICULAR CHARACTERS, WORDS, OR PATTERNS OF CHARACTERS.
WHAT ARE REGULAR EXPRESSIONS
THE REGEX COACH IS A GRAPHICAL APPLICATION
FOR WINDOWS WHICH CAN BE USED TO
EXPERIMENT WITH REGULAR EXPRESSIONS
INTERACTIVELY.
◦ http://weitz.de/regex-coach/
Sublime Text is a text editor that has support of find and
replace using Regular Expressions.
Web based Regular Expressions tester.
◦ http://www.regular-expressions.info/
THE MOST BASIC REGULAR EXPRESSION CONSISTS OF A LITERAL
which behaves just like string matching. For e.g.
◦ cat will match cat in About cats and dogs.
Special characters known as meta characters needs to be escaped with a  in
regular expressions if they are used as part of a literal:
◦ dogs.will match dogs. in About cats and dogs.
Meta characters are:
◦ [  ^ $ . | ? * + ( ) {
WITH A "CHARACTER CLASS", ALSO CALLED "CHARACTER SET", YOU CAN TELL
THE REGEX ENGINE TO MATCH ONLY ONE OUT OF SEVERAL CHARACTERS.
FOR E.G.
◦ gr[ae]ywill match grey and gray both.
Ranges can be specified using dash. For e.g.
◦ [0-9]will match any digit from 0 to 9.
◦ [0-9a-fA-F]will match any single hexadecimal digit.
Caret after the opening square bracket will negate the character class.
• The result is that the character class will match any character that is not
• in the character class. For e.g.
◦ [^0-9] will match any thing except number.
◦ q[^u] will not match Iraq but it will match Iraq is a country
Meta characters works fine without escaping in Character classes. For e.g.
◦ [+*]is a valid expression and match either * or +.
There are some pre-defined character classes known as short hand
character classes:
◦ w stands for[A-Za-z0-9_]
◦ s stands for[ trn]
◦ d stands for[0-9]
If a character class is repeated by using the ?, * or + operators, the
entire character class will be repeated, and not just the character that it
matched. For e.g.
◦ [0-9]+ can match 837 as well as 222
◦ ([0-9])1+ will match 222 but not 837.
The famous dot “.” operator matches anything. For e.g.
◦ a.b will match abb, aab, a+b etc.
^ and $ are used to match start and end of regular expressions. For e.g.
◦ ^My.*.$ will match anything starting with My and ending with a dot.
Pipe operator is used to match a string against either its left or the right
part. For e.g.
◦ (cat|dog) can match both cat or dog.
Question:
◦ If the expression is Get|GetValue|Set|SetValue and string is SetValue.
What will this match and why?
◦ What if the expression becomes Get(Value)?|Set(Value)?
* or {0,} and+ or {1,} are used to control repititions.
Round brackets besides grouping part of a regular expression
together, also create a "backreference". A backreference stores the
matching part of the string matched by the part of the regular
expression inside the parentheses. For e.g.
◦ ([0-9])1+ will match 222 but not 837.
If backreference are not required, you can optimize this regular
expression Set(?:Value)?
Backreferences can be used in expressions itself or in replacement
text. For e.g.
◦ <([A-Za-z][A-Za-z0-9]*)>.*</1>will match matching opening and closing tags.
/i makes the regex match case insensitive.
◦ [A-Z] will match A and a with this modifier.
/s enables "single-line mode". In this mode, the dot matches
newlines as well.
◦ .* will match sherazrnattari with this modifier.
/m enables "multi-line mode". In this mode, the caret and dollar
match before and after newlines in the subject string.
◦ .* will match only sherazin sherazrnattari with this modifier.
/x enables "free-spacing mode". In this mode, whitespace between
regex tokens is ignored, and an unescaped # starts a comment.
◦ #sherazrnrn.* will match only sheraz in with this modifier.
A conditional is a special construct that will first evaluate a lookaround, and then execute one
sub-regex if the lookaround succeeds, and another sub-regex if the lookaround fails.
Example of Positive lookahead is:
◦ q(?=uv*)will match q in quvvvv and qu.
Example of Negative lookahead is:
◦ q(?!uv*)will match q not followed by u and uv.
Example of Positive lookbehind is:
◦ (?<=b)awill match a prefixed by b like ba.
Example of Negative lookbehind is:
◦ (?<!b)awill match a not prefixed by b like ca and da etc.
abc… Letters
123… Digits
d Any Digit
D Any Non-digit character
. Any Character
. Period
[abc] Only a, b, or c
[^abc]Not a, b, nor c
[a-z] Characters a to z
[0-9] Numbers 0 to 9
w Any Alphanumeric character
W Any Non-alphanumeric character
{m} m Repetitions
{m,n} m to n Repetitions
* Zero or more repetitions
+ One or more repetitions
? Optional character
s Any Whitespace
S Any Non-whitespace character
^…$ Starts and ends
(…) Capture Group
(a(bc)) Capture Sub-group
(.*) Capture all
(abc|def) Matches abc or def
Most of the content is taken from
http://www.regular-expressions.info/
THANK YOU!

More Related Content

Similar to Regular Expression Crash Course

Regular Expression in Action
Regular Expression in ActionRegular Expression in Action
Regular Expression in Action
Folio3 Software
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
Satya Narayana
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
keeyre
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
Raj Gupta
 
Regular Expression Cheat Sheet
Regular Expression Cheat SheetRegular Expression Cheat Sheet
Regular Expression Cheat Sheet
SydneyJohnson57
 
Javascript正则表达式
Javascript正则表达式Javascript正则表达式
Javascript正则表达式
ji guang
 
Unit 1-strings,patterns and regular expressions
Unit 1-strings,patterns and regular expressionsUnit 1-strings,patterns and regular expressions
Unit 1-strings,patterns and regular expressions
sana mateen
 
Strings,patterns and regular expressions in perl
Strings,patterns and regular expressions in perlStrings,patterns and regular expressions in perl
Strings,patterns and regular expressions in perl
sana mateen
 
2013 - Andrei Zmievski: Clínica Regex
2013 - Andrei Zmievski: Clínica Regex2013 - Andrei Zmievski: Clínica Regex
2013 - Andrei Zmievski: Clínica Regex
PHP Conference Argentina
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular Expressions
Mukesh Tekwani
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
Mahzad Zahedi
 
2.regular expressions
2.regular expressions2.regular expressions
2.regular expressions
Praveen Gorantla
 
3.2 javascript regex
3.2 javascript regex3.2 javascript regex
3.2 javascript regex
Jalpesh Vasa
 
16 Java Regex
16 Java Regex16 Java Regex
16 Java Regex
wayn
 
Adv. python regular expression by Rj
Adv. python regular expression by RjAdv. python regular expression by Rj
Adv. python regular expression by Rj
Shree M.L.Kakadiya MCA mahila college, Amreli
 
Regex startup
Regex startupRegex startup
Regex startup
PayPal
 
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 JavaScript - Chapter 9 - TypeConversion and Regular Expressions  JavaScript - Chapter 9 - TypeConversion and Regular Expressions
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
WebStackAcademy
 
Ruby RegEx
Ruby RegExRuby RegEx
Ruby RegEx
Sarah Allen
 
Regular Expressions and You
Regular Expressions and YouRegular Expressions and You
Regular Expressions and You
James Armes
 
Maxbox starter20
Maxbox starter20Maxbox starter20
Maxbox starter20
Max Kleiner
 

Similar to Regular Expression Crash Course (20)

Regular Expression in Action
Regular Expression in ActionRegular Expression in Action
Regular Expression in Action
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regular Expression Cheat Sheet
Regular Expression Cheat SheetRegular Expression Cheat Sheet
Regular Expression Cheat Sheet
 
Javascript正则表达式
Javascript正则表达式Javascript正则表达式
Javascript正则表达式
 
Unit 1-strings,patterns and regular expressions
Unit 1-strings,patterns and regular expressionsUnit 1-strings,patterns and regular expressions
Unit 1-strings,patterns and regular expressions
 
Strings,patterns and regular expressions in perl
Strings,patterns and regular expressions in perlStrings,patterns and regular expressions in perl
Strings,patterns and regular expressions in perl
 
2013 - Andrei Zmievski: Clínica Regex
2013 - Andrei Zmievski: Clínica Regex2013 - Andrei Zmievski: Clínica Regex
2013 - Andrei Zmievski: Clínica Regex
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular Expressions
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
2.regular expressions
2.regular expressions2.regular expressions
2.regular expressions
 
3.2 javascript regex
3.2 javascript regex3.2 javascript regex
3.2 javascript regex
 
16 Java Regex
16 Java Regex16 Java Regex
16 Java Regex
 
Adv. python regular expression by Rj
Adv. python regular expression by RjAdv. python regular expression by Rj
Adv. python regular expression by Rj
 
Regex startup
Regex startupRegex startup
Regex startup
 
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 JavaScript - Chapter 9 - TypeConversion and Regular Expressions  JavaScript - Chapter 9 - TypeConversion and Regular Expressions
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 
Ruby RegEx
Ruby RegExRuby RegEx
Ruby RegEx
 
Regular Expressions and You
Regular Expressions and YouRegular Expressions and You
Regular Expressions and You
 
Maxbox starter20
Maxbox starter20Maxbox starter20
Maxbox starter20
 

Recently uploaded

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 

Recently uploaded (20)

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 

Regular Expression Crash Course

  • 1. REGULAR EXPRESSION IN ACTION Brief overview of Regular Expression building blocks and tools with a practical example
  • 2. REGULAR EXPRESSIONS PROVIDE A CONCISE AND FLEXIBLE MEANS FOR MATCHING STRINGS OF TEXT, SUCH AS PARTICULAR CHARACTERS, WORDS, OR PATTERNS OF CHARACTERS. WHAT ARE REGULAR EXPRESSIONS
  • 3. THE REGEX COACH IS A GRAPHICAL APPLICATION FOR WINDOWS WHICH CAN BE USED TO EXPERIMENT WITH REGULAR EXPRESSIONS INTERACTIVELY. ◦ http://weitz.de/regex-coach/ Sublime Text is a text editor that has support of find and replace using Regular Expressions. Web based Regular Expressions tester. ◦ http://www.regular-expressions.info/
  • 4. THE MOST BASIC REGULAR EXPRESSION CONSISTS OF A LITERAL which behaves just like string matching. For e.g. ◦ cat will match cat in About cats and dogs. Special characters known as meta characters needs to be escaped with a in regular expressions if they are used as part of a literal: ◦ dogs.will match dogs. in About cats and dogs. Meta characters are: ◦ [ ^ $ . | ? * + ( ) {
  • 5. WITH A "CHARACTER CLASS", ALSO CALLED "CHARACTER SET", YOU CAN TELL THE REGEX ENGINE TO MATCH ONLY ONE OUT OF SEVERAL CHARACTERS. FOR E.G. ◦ gr[ae]ywill match grey and gray both. Ranges can be specified using dash. For e.g. ◦ [0-9]will match any digit from 0 to 9. ◦ [0-9a-fA-F]will match any single hexadecimal digit. Caret after the opening square bracket will negate the character class. • The result is that the character class will match any character that is not • in the character class. For e.g. ◦ [^0-9] will match any thing except number. ◦ q[^u] will not match Iraq but it will match Iraq is a country
  • 6. Meta characters works fine without escaping in Character classes. For e.g. ◦ [+*]is a valid expression and match either * or +. There are some pre-defined character classes known as short hand character classes: ◦ w stands for[A-Za-z0-9_] ◦ s stands for[ trn] ◦ d stands for[0-9] If a character class is repeated by using the ?, * or + operators, the entire character class will be repeated, and not just the character that it matched. For e.g. ◦ [0-9]+ can match 837 as well as 222 ◦ ([0-9])1+ will match 222 but not 837.
  • 7. The famous dot “.” operator matches anything. For e.g. ◦ a.b will match abb, aab, a+b etc. ^ and $ are used to match start and end of regular expressions. For e.g. ◦ ^My.*.$ will match anything starting with My and ending with a dot. Pipe operator is used to match a string against either its left or the right part. For e.g. ◦ (cat|dog) can match both cat or dog. Question: ◦ If the expression is Get|GetValue|Set|SetValue and string is SetValue. What will this match and why? ◦ What if the expression becomes Get(Value)?|Set(Value)? * or {0,} and+ or {1,} are used to control repititions.
  • 8. Round brackets besides grouping part of a regular expression together, also create a "backreference". A backreference stores the matching part of the string matched by the part of the regular expression inside the parentheses. For e.g. ◦ ([0-9])1+ will match 222 but not 837. If backreference are not required, you can optimize this regular expression Set(?:Value)? Backreferences can be used in expressions itself or in replacement text. For e.g. ◦ <([A-Za-z][A-Za-z0-9]*)>.*</1>will match matching opening and closing tags.
  • 9. /i makes the regex match case insensitive. ◦ [A-Z] will match A and a with this modifier. /s enables "single-line mode". In this mode, the dot matches newlines as well. ◦ .* will match sherazrnattari with this modifier. /m enables "multi-line mode". In this mode, the caret and dollar match before and after newlines in the subject string. ◦ .* will match only sherazin sherazrnattari with this modifier. /x enables "free-spacing mode". In this mode, whitespace between regex tokens is ignored, and an unescaped # starts a comment. ◦ #sherazrnrn.* will match only sheraz in with this modifier.
  • 10. A conditional is a special construct that will first evaluate a lookaround, and then execute one sub-regex if the lookaround succeeds, and another sub-regex if the lookaround fails. Example of Positive lookahead is: ◦ q(?=uv*)will match q in quvvvv and qu. Example of Negative lookahead is: ◦ q(?!uv*)will match q not followed by u and uv. Example of Positive lookbehind is: ◦ (?<=b)awill match a prefixed by b like ba. Example of Negative lookbehind is: ◦ (?<!b)awill match a not prefixed by b like ca and da etc.
  • 11. abc… Letters 123… Digits d Any Digit D Any Non-digit character . Any Character . Period [abc] Only a, b, or c [^abc]Not a, b, nor c [a-z] Characters a to z [0-9] Numbers 0 to 9 w Any Alphanumeric character W Any Non-alphanumeric character {m} m Repetitions {m,n} m to n Repetitions * Zero or more repetitions + One or more repetitions ? Optional character s Any Whitespace S Any Non-whitespace character ^…$ Starts and ends (…) Capture Group (a(bc)) Capture Sub-group (.*) Capture all (abc|def) Matches abc or def
  • 12. Most of the content is taken from http://www.regular-expressions.info/ THANK YOU!