SlideShare a Scribd company logo
1 of 10
Download to read offline
Syd Johnson 2018
Regular Expression Cheat Sheet
This cheat sheet exists to support you throughout your journey
conquering Regular Expression. Use it to discover, organize, and
implement your ideas. Read it. Learn it. Visit it often.
Expression Function Example

Common Tokens
This common token has many
different uses. If a special
character (!, @, #, $, %, etc.)
is already a part of the text
string you want to match,
insert this token before the
problem character, and your
string will still take effect.
( )
This common token will match
whatever character(s) enclosed
inside of it.
Syd Johnson 2018
[ ]
Trap your characters in square
brackets to convey a range of
numbers or letters.
Your square brackets don’t
have to contain ranges; try a
few specific characters for a
more tailored approach. This
function works with any
characters in any order.
Include both uppercase and
lowercase ranges in your
brackets to exclude case
sensitivity.
Insert a ^ before your
range/characters in your square
brackets to exclude whatever
follows it.
. This common token will find
absolutely any character,
whether numerical or
alphabetical.
Syd Johnson 2018
.
This common token followed
with the quantifier * serves as
an ultimate catch all. The two
tokens together will find any
characters with any or all
repetitions.
|
This is an alternation
expression. It provides the
ability to communicate that
you want options in your
matches. It essentially
translates to “OR.”
Make sure to use parentheses
instead of square brackets to
house this token.
**Identical expressions and unidentical phone
numbers.
The token . is inserted to identify the
parentheses.**
^
Anchors
This anchor signifies the start
of a line. It’s inserted at the
beginning of a string.
This anchor holds a different
function inside and outside of
brackets.
$
This anchor signifies the end of
a line. It’s inserted at the end
of a string.
Syd Johnson 2018
$
An exact sentence match can
be made when the anchors ^
and $ are used in the same
string.
A This anchor serves to match at
the starting point of the
character string. This anchor is
inserted at the beginning of the
regex.
A not included:
A included:
**In the Regex above, [0-9]+ signifies a string
of digits with one or more repetitions**
Z This anchor serves to match at
the ending point of the
character string. This anchor is
inserted at the end of the regex.
B not included:
B included:
**In the Regex above, [0-9]+ signifies a string
of digits with one or more repetitions**
Syd Johnson 2018
b
This anchor serves to separate
groups of letters and/or digits.
This anchor does not consume
any characters and does not
consider any non-
numerical/non-alphabetical
characters.
B
This anchor serves to separate
each numerical or alphabetical
character when not connected
to a non-alphabetical/non-
numerical character.
{ }
Quantifiers
Insert a number in curvy
brackets at the end of a string
to signify how many
repetitions you’re
looking for.
Insert a comma between two
numbers in curvy brackets to
signify a range of desired
repetitions.
If you’d like to represent
infinity, insert a comma after
your minimum desired
repetitions.
Syd Johnson 2018
?
Insert this quantifier at the end
of a string to signify up to one
repetition. It’s essentially
making the string optional.
+
Insert this quantifier at the end
of a string to signify one to an
infinite amount of repetitions
({1,}).
*
Insert this quantifier at the end
of a string to signify zero to an
infinite amount of repetitions.
This is a catch all; it could
either inform you that the
desired string doesn’t exist or
that it exists many times.
Syd Johnson 2018
s
Meta Sequences
This meta sequence will match
any whitespace character in the
string.
S This meta sequence will match
any character other than a
whitespace.
d This meta sequences will
match any digit.
D This meta sequence will match
any non-digit.
Syd Johnson 2018
w
This meta sequence will match
any alphabetical or numerical
character.
When the quantifier + (one to
infinite repetitions) is inserted
following this token, it will
match whole words.
W
This meta sequence will match
any character other than a letter
or number.
v
This meta sequence serves to
recognize the number of
newlines. It won’t consume
any characters.
K
This meta sequence will
modify the regular expression
to begin to match characters at
a certain point.
**The [0-9]+ in this expression signifies one or
more repetitions of numerical characters, the
[A-Za-z]+ signifies one or more repetitions of
non-case sensitive alphabetical characters,
and the s serves to match whitespace.**
Syd Johnson 2018
Q E
When special characters are
enclosed in between these two
meta sequences, those
character are then treated as
literals.
CHALLENGER
Once you understand the functions above, see if you can build a
Regular Expression that will match your home address. Be sure
to use https://www.regex101.com to check your answer.
TIP
The meta sequence /s matches non-character spaces (the white
space!), and the quantifier + signifies one or more repetitions.
ANSWER
With some flexibility, your Regular Expression could look
something like this:
[0-9]+s[A-Za-z]+s[A-Za-z]+
Syd Johnson 2018
(?<regex)
Group Constructs
This group construct is called a
positive lookahead. It assists in
identifying characters that are
preceded with other known
characters.
This construct is inserted at the
beginning of a string.
To identify a set of letters preceded by
a set of numbers:
**The quantifier + in this Regex is
signifying one to an infinite number
of repetitions**
(?=regex)
This group construct is called a
negative lookbehind. It assists in
identifying characters that are
followed by other known
characters.
This construct is inserted at the
end of a string.
To identify a set of letters followed by a
set of numbers:
**The quantifier + in this Regex is
signifying one to an infinite number
of repetitions**
[[:<:]]
Character Classes
This character class will match
the first character of your choice
wherever it begins a word/group
of characters. The desired
letter/number must be inserted
at the end of the expression.
[[:>:]]
This character class will match
the first character of your choice
whenever it ends a word/group
of characters. The desired
letter/number must be inserted
at the beginning of the
expression

More Related Content

What's hot

Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes IntroductionPeng Xiao
 
Cloud Native Engineering with SRE and GitOps
Cloud Native Engineering with SRE and GitOpsCloud Native Engineering with SRE and GitOps
Cloud Native Engineering with SRE and GitOpsWeaveworks
 
[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...
[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...
[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...Amazon Web Services Korea
 
Transforming Governments in the Cloud
Transforming Governments in the CloudTransforming Governments in the Cloud
Transforming Governments in the CloudAmazon Web Services
 
세션 3: IT 담당자를 위한 Cloud 로의 전환
세션 3: IT 담당자를 위한 Cloud 로의 전환세션 3: IT 담당자를 위한 Cloud 로의 전환
세션 3: IT 담당자를 위한 Cloud 로의 전환Amazon Web Services Korea
 
DevOps - CI/CD 알아보기
DevOps - CI/CD 알아보기DevOps - CI/CD 알아보기
DevOps - CI/CD 알아보기SeungYong Baek
 
DevOps Open House III - Kubernetes using YAML
DevOps Open House III - Kubernetes using YAMLDevOps Open House III - Kubernetes using YAML
DevOps Open House III - Kubernetes using YAMLAgile Testing Alliance
 
DevSecOps : an Introduction
DevSecOps : an IntroductionDevSecOps : an Introduction
DevSecOps : an IntroductionPrashanth B. P.
 
Aws certified-solutions-architect-associate-training
Aws certified-solutions-architect-associate-trainingAws certified-solutions-architect-associate-training
Aws certified-solutions-architect-associate-trainingCloudsara
 
고객의 플랫폼/서비스를 개선한 국내 사례 살펴보기 – 장준성 AWS 솔루션즈 아키텍트, 강산아 NDREAM 팀장, 송영호 야놀자 매니저, ...
고객의 플랫폼/서비스를 개선한 국내 사례 살펴보기 – 장준성 AWS 솔루션즈 아키텍트, 강산아 NDREAM 팀장, 송영호 야놀자 매니저, ...고객의 플랫폼/서비스를 개선한 국내 사례 살펴보기 – 장준성 AWS 솔루션즈 아키텍트, 강산아 NDREAM 팀장, 송영호 야놀자 매니저, ...
고객의 플랫폼/서비스를 개선한 국내 사례 살펴보기 – 장준성 AWS 솔루션즈 아키텍트, 강산아 NDREAM 팀장, 송영호 야놀자 매니저, ...Amazon Web Services Korea
 
천만 사용자를 위한 AWS 클라우드 아키텍쳐 진화하기- AWS Summit Seoul 2017
천만 사용자를 위한 AWS 클라우드 아키텍쳐 진화하기- AWS Summit Seoul 2017천만 사용자를 위한 AWS 클라우드 아키텍쳐 진화하기- AWS Summit Seoul 2017
천만 사용자를 위한 AWS 클라우드 아키텍쳐 진화하기- AWS Summit Seoul 2017Amazon Web Services Korea
 
Chris Munns, DevOps @ Amazon: Microservices, 2 Pizza Teams, & 50 Million Depl...
Chris Munns, DevOps @ Amazon: Microservices, 2 Pizza Teams, & 50 Million Depl...Chris Munns, DevOps @ Amazon: Microservices, 2 Pizza Teams, & 50 Million Depl...
Chris Munns, DevOps @ Amazon: Microservices, 2 Pizza Teams, & 50 Million Depl...TriNimbus
 
Rancher and Kubernetes Best Practices
Rancher and  Kubernetes Best PracticesRancher and  Kubernetes Best Practices
Rancher and Kubernetes Best PracticesAvinash Patil
 
DevOps: A Value Proposition
DevOps: A Value PropositionDevOps: A Value Proposition
DevOps: A Value PropositionNicole Forsgren
 

What's hot (20)

Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
1시간으로 끝내는 클라우드 개념_김민형 클라우드 솔루션 아키텍트
1시간으로 끝내는 클라우드 개념_김민형 클라우드 솔루션 아키텍트1시간으로 끝내는 클라우드 개념_김민형 클라우드 솔루션 아키텍트
1시간으로 끝내는 클라우드 개념_김민형 클라우드 솔루션 아키텍트
 
Cloud Native Engineering with SRE and GitOps
Cloud Native Engineering with SRE and GitOpsCloud Native Engineering with SRE and GitOps
Cloud Native Engineering with SRE and GitOps
 
Devops maturity model
Devops maturity modelDevops maturity model
Devops maturity model
 
[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...
[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...
[Retail & CPG Day 2019] 리테일/소비재 부문의 고객 경험 강화를 위한 기술변화 방향과 고객 사례 (ZIGZAG) - 김선...
 
Automation CICD
Automation CICDAutomation CICD
Automation CICD
 
Transforming Governments in the Cloud
Transforming Governments in the CloudTransforming Governments in the Cloud
Transforming Governments in the Cloud
 
Azure DevOps
Azure DevOpsAzure DevOps
Azure DevOps
 
세션 3: IT 담당자를 위한 Cloud 로의 전환
세션 3: IT 담당자를 위한 Cloud 로의 전환세션 3: IT 담당자를 위한 Cloud 로의 전환
세션 3: IT 담당자를 위한 Cloud 로의 전환
 
AWS Systems Manager
AWS Systems ManagerAWS Systems Manager
AWS Systems Manager
 
DevOps - CI/CD 알아보기
DevOps - CI/CD 알아보기DevOps - CI/CD 알아보기
DevOps - CI/CD 알아보기
 
DevOps Open House III - Kubernetes using YAML
DevOps Open House III - Kubernetes using YAMLDevOps Open House III - Kubernetes using YAML
DevOps Open House III - Kubernetes using YAML
 
DevSecOps : an Introduction
DevSecOps : an IntroductionDevSecOps : an Introduction
DevSecOps : an Introduction
 
Aws certified-solutions-architect-associate-training
Aws certified-solutions-architect-associate-trainingAws certified-solutions-architect-associate-training
Aws certified-solutions-architect-associate-training
 
고객의 플랫폼/서비스를 개선한 국내 사례 살펴보기 – 장준성 AWS 솔루션즈 아키텍트, 강산아 NDREAM 팀장, 송영호 야놀자 매니저, ...
고객의 플랫폼/서비스를 개선한 국내 사례 살펴보기 – 장준성 AWS 솔루션즈 아키텍트, 강산아 NDREAM 팀장, 송영호 야놀자 매니저, ...고객의 플랫폼/서비스를 개선한 국내 사례 살펴보기 – 장준성 AWS 솔루션즈 아키텍트, 강산아 NDREAM 팀장, 송영호 야놀자 매니저, ...
고객의 플랫폼/서비스를 개선한 국내 사례 살펴보기 – 장준성 AWS 솔루션즈 아키텍트, 강산아 NDREAM 팀장, 송영호 야놀자 매니저, ...
 
천만 사용자를 위한 AWS 클라우드 아키텍쳐 진화하기- AWS Summit Seoul 2017
천만 사용자를 위한 AWS 클라우드 아키텍쳐 진화하기- AWS Summit Seoul 2017천만 사용자를 위한 AWS 클라우드 아키텍쳐 진화하기- AWS Summit Seoul 2017
천만 사용자를 위한 AWS 클라우드 아키텍쳐 진화하기- AWS Summit Seoul 2017
 
Chris Munns, DevOps @ Amazon: Microservices, 2 Pizza Teams, & 50 Million Depl...
Chris Munns, DevOps @ Amazon: Microservices, 2 Pizza Teams, & 50 Million Depl...Chris Munns, DevOps @ Amazon: Microservices, 2 Pizza Teams, & 50 Million Depl...
Chris Munns, DevOps @ Amazon: Microservices, 2 Pizza Teams, & 50 Million Depl...
 
Rancher and Kubernetes Best Practices
Rancher and  Kubernetes Best PracticesRancher and  Kubernetes Best Practices
Rancher and Kubernetes Best Practices
 
DevOps: A Value Proposition
DevOps: A Value PropositionDevOps: A Value Proposition
DevOps: A Value Proposition
 
Getting started with AWS
Getting started with AWSGetting started with AWS
Getting started with AWS
 

Similar to Regular Expression Cheat Sheet

Regular expressions
Regular expressionsRegular expressions
Regular expressionsRaghu nath
 
Regular_Expressions.pptx
Regular_Expressions.pptxRegular_Expressions.pptx
Regular_Expressions.pptxDurgaNayak4
 
Regular Expression in Action
Regular Expression in ActionRegular Expression in Action
Regular Expression in ActionFolio3 Software
 
FUNDAMENTALS OF REGULAR EXPRESSION (RegEX).pdf
FUNDAMENTALS OF REGULAR EXPRESSION (RegEX).pdfFUNDAMENTALS OF REGULAR EXPRESSION (RegEX).pdf
FUNDAMENTALS OF REGULAR EXPRESSION (RegEX).pdfBryan Alejos
 
Maxbox starter20
Maxbox starter20Maxbox starter20
Maxbox starter20Max Kleiner
 
Introduction_to_Regular_Expressions_in_R
Introduction_to_Regular_Expressions_in_RIntroduction_to_Regular_Expressions_in_R
Introduction_to_Regular_Expressions_in_RHellen Gakuruh
 
Regular Expression Crash Course
Regular Expression Crash CourseRegular Expression Crash Course
Regular Expression Crash CourseImran Qasim
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionskeeyre
 
Looking for Patterns
Looking for PatternsLooking for Patterns
Looking for PatternsKeith Wright
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular ExpressionsMukesh Tekwani
 
Bioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introductionBioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introductionProf. Wim Van Criekinge
 
Basta mastering regex power
Basta mastering regex powerBasta mastering regex power
Basta mastering regex powerMax Kleiner
 
What is JavaScript Regex | Regular Expressions in JavaScript | Edureka
What is JavaScript Regex | Regular Expressions in JavaScript | EdurekaWhat is JavaScript Regex | Regular Expressions in JavaScript | Edureka
What is JavaScript Regex | Regular Expressions in JavaScript | EdurekaEdureka!
 
Chapter 3: Introduction to Regular Expression
Chapter 3: Introduction to Regular ExpressionChapter 3: Introduction to Regular Expression
Chapter 3: Introduction to Regular Expressionazzamhadeel89
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsRaj Gupta
 

Similar to Regular Expression Cheat Sheet (20)

Adv. python regular expression by Rj
Adv. python regular expression by RjAdv. python regular expression by Rj
Adv. python regular expression by Rj
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regular_Expressions.pptx
Regular_Expressions.pptxRegular_Expressions.pptx
Regular_Expressions.pptx
 
Regular Expressions in Stata
Regular Expressions in StataRegular Expressions in Stata
Regular Expressions in Stata
 
2013 - Andrei Zmievski: Clínica Regex
2013 - Andrei Zmievski: Clínica Regex2013 - Andrei Zmievski: Clínica Regex
2013 - Andrei Zmievski: Clínica Regex
 
Regular Expression in Action
Regular Expression in ActionRegular Expression in Action
Regular Expression in Action
 
Regex lecture
Regex lectureRegex lecture
Regex lecture
 
FUNDAMENTALS OF REGULAR EXPRESSION (RegEX).pdf
FUNDAMENTALS OF REGULAR EXPRESSION (RegEX).pdfFUNDAMENTALS OF REGULAR EXPRESSION (RegEX).pdf
FUNDAMENTALS OF REGULAR EXPRESSION (RegEX).pdf
 
Maxbox starter20
Maxbox starter20Maxbox starter20
Maxbox starter20
 
Introduction_to_Regular_Expressions_in_R
Introduction_to_Regular_Expressions_in_RIntroduction_to_Regular_Expressions_in_R
Introduction_to_Regular_Expressions_in_R
 
Regular Expression Crash Course
Regular Expression Crash CourseRegular Expression Crash Course
Regular Expression Crash Course
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Looking for Patterns
Looking for PatternsLooking for Patterns
Looking for Patterns
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular Expressions
 
Bioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introductionBioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introduction
 
Basta mastering regex power
Basta mastering regex powerBasta mastering regex power
Basta mastering regex power
 
What is JavaScript Regex | Regular Expressions in JavaScript | Edureka
What is JavaScript Regex | Regular Expressions in JavaScript | EdurekaWhat is JavaScript Regex | Regular Expressions in JavaScript | Edureka
What is JavaScript Regex | Regular Expressions in JavaScript | Edureka
 
Chapter 3: Introduction to Regular Expression
Chapter 3: Introduction to Regular ExpressionChapter 3: Introduction to Regular Expression
Chapter 3: Introduction to Regular Expression
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 

Recently uploaded

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 

Recently uploaded (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 

Regular Expression Cheat Sheet

  • 1. Syd Johnson 2018 Regular Expression Cheat Sheet This cheat sheet exists to support you throughout your journey conquering Regular Expression. Use it to discover, organize, and implement your ideas. Read it. Learn it. Visit it often. Expression Function Example Common Tokens This common token has many different uses. If a special character (!, @, #, $, %, etc.) is already a part of the text string you want to match, insert this token before the problem character, and your string will still take effect. ( ) This common token will match whatever character(s) enclosed inside of it.
  • 2. Syd Johnson 2018 [ ] Trap your characters in square brackets to convey a range of numbers or letters. Your square brackets don’t have to contain ranges; try a few specific characters for a more tailored approach. This function works with any characters in any order. Include both uppercase and lowercase ranges in your brackets to exclude case sensitivity. Insert a ^ before your range/characters in your square brackets to exclude whatever follows it. . This common token will find absolutely any character, whether numerical or alphabetical.
  • 3. Syd Johnson 2018 . This common token followed with the quantifier * serves as an ultimate catch all. The two tokens together will find any characters with any or all repetitions. | This is an alternation expression. It provides the ability to communicate that you want options in your matches. It essentially translates to “OR.” Make sure to use parentheses instead of square brackets to house this token. **Identical expressions and unidentical phone numbers. The token . is inserted to identify the parentheses.** ^ Anchors This anchor signifies the start of a line. It’s inserted at the beginning of a string. This anchor holds a different function inside and outside of brackets. $ This anchor signifies the end of a line. It’s inserted at the end of a string.
  • 4. Syd Johnson 2018 $ An exact sentence match can be made when the anchors ^ and $ are used in the same string. A This anchor serves to match at the starting point of the character string. This anchor is inserted at the beginning of the regex. A not included: A included: **In the Regex above, [0-9]+ signifies a string of digits with one or more repetitions** Z This anchor serves to match at the ending point of the character string. This anchor is inserted at the end of the regex. B not included: B included: **In the Regex above, [0-9]+ signifies a string of digits with one or more repetitions**
  • 5. Syd Johnson 2018 b This anchor serves to separate groups of letters and/or digits. This anchor does not consume any characters and does not consider any non- numerical/non-alphabetical characters. B This anchor serves to separate each numerical or alphabetical character when not connected to a non-alphabetical/non- numerical character. { } Quantifiers Insert a number in curvy brackets at the end of a string to signify how many repetitions you’re looking for. Insert a comma between two numbers in curvy brackets to signify a range of desired repetitions. If you’d like to represent infinity, insert a comma after your minimum desired repetitions.
  • 6. Syd Johnson 2018 ? Insert this quantifier at the end of a string to signify up to one repetition. It’s essentially making the string optional. + Insert this quantifier at the end of a string to signify one to an infinite amount of repetitions ({1,}). * Insert this quantifier at the end of a string to signify zero to an infinite amount of repetitions. This is a catch all; it could either inform you that the desired string doesn’t exist or that it exists many times.
  • 7. Syd Johnson 2018 s Meta Sequences This meta sequence will match any whitespace character in the string. S This meta sequence will match any character other than a whitespace. d This meta sequences will match any digit. D This meta sequence will match any non-digit.
  • 8. Syd Johnson 2018 w This meta sequence will match any alphabetical or numerical character. When the quantifier + (one to infinite repetitions) is inserted following this token, it will match whole words. W This meta sequence will match any character other than a letter or number. v This meta sequence serves to recognize the number of newlines. It won’t consume any characters. K This meta sequence will modify the regular expression to begin to match characters at a certain point. **The [0-9]+ in this expression signifies one or more repetitions of numerical characters, the [A-Za-z]+ signifies one or more repetitions of non-case sensitive alphabetical characters, and the s serves to match whitespace.**
  • 9. Syd Johnson 2018 Q E When special characters are enclosed in between these two meta sequences, those character are then treated as literals. CHALLENGER Once you understand the functions above, see if you can build a Regular Expression that will match your home address. Be sure to use https://www.regex101.com to check your answer. TIP The meta sequence /s matches non-character spaces (the white space!), and the quantifier + signifies one or more repetitions. ANSWER With some flexibility, your Regular Expression could look something like this: [0-9]+s[A-Za-z]+s[A-Za-z]+
  • 10. Syd Johnson 2018 (?<regex) Group Constructs This group construct is called a positive lookahead. It assists in identifying characters that are preceded with other known characters. This construct is inserted at the beginning of a string. To identify a set of letters preceded by a set of numbers: **The quantifier + in this Regex is signifying one to an infinite number of repetitions** (?=regex) This group construct is called a negative lookbehind. It assists in identifying characters that are followed by other known characters. This construct is inserted at the end of a string. To identify a set of letters followed by a set of numbers: **The quantifier + in this Regex is signifying one to an infinite number of repetitions** [[:<:]] Character Classes This character class will match the first character of your choice wherever it begins a word/group of characters. The desired letter/number must be inserted at the end of the expression. [[:>:]] This character class will match the first character of your choice whenever it ends a word/group of characters. The desired letter/number must be inserted at the beginning of the expression