SlideShare a Scribd company logo
Anchors                                     Quantifiers                                 Groups and Ranges

^                Start of string            *                 0 or more                  .             Any character except
A               Start of string            +                 1 or more                                new line (n)
$                End of string              ?                 0 or 1                     (a|b)         a or b
Z               End of string              {3}               Exactly 3                  (...)         Group
b               Word boundary              {3,}              3 or more                  (?:...)       Passive Group
B               Not word boundary          {3,5}             3, 4 or 5                  [abc]         Range (a or b or c)
<               Start of word                                                           [^abc]        Not a or b or c
>               End of word                                                             [a-q]         Letter between a and q
                                            Quantifier Modifiers
                                                                                         [A-Q]         Upper case letter
                                            "x" below represents a quantifier                          between A and Q
Character Classes
                                            x?                                           [0-7]         Digit between 0 and 7
                                                              Ungreedy version of "x"
                                                                                         n          nth group/subpattern
c               Control character
                                                                                         Note: Ranges are inclusive.
s               White space                Escape Character
S               Not white space
d               Digit                                                                 Pattern Modifiers
                                                              Escape Character
D               Not digit
w                                                                                       g            Global match
                 Word
W                                          Metacharacters (must be escaped)             i            Case-insensitive
                 Not word
x                                                                                       m            Multiple lines
                 Hexadecimal digit
                                                   ^             [              .        s            Treat string as single line
O               Octal digit
                                                   $             {              *        x            Allow comments and
                                                   (                           +                     white space in pattern
POSIX
                                                   )             |              ?        e            Evaluate replacement
                                                   <             >                       U            Ungreedy pattern
[:upper:]        Upper case letters
[:lower:]        Lower case letters
[:alpha:]        All letters                Special Characters                          String Replacement (Backreferences)
[:alnum:]        Digits and letters
[:digit:]        Digits                     n                New line                   $n           nth non-passive group
[:xdigit:]       Hexadecimal digits         r                Carriage return            $2           "xyz" in /^(abc(xyz))$/
[:punct:]        Punctuation                t                Tab                        $1           "xyz" in /^(?:abc)(xyz)$/
[:blank:]        Space and tab              v                Vertical tab               $`           Before matched string
[:space:]        Blank characters           f                Form feed                  $'           After matched string
[:cntrl:]        Control characters         xxx              Octal character xxx        $+           Last matched string
[:graph:]        Printed characters         xhh              Hex character hh           $&           Entire matched string
[:print:]        Printed characters and
                 spaces                     Sample Patterns
[:word:]         Digits, letters and
                 underscore                 Pattern                                      Will Match
                                            ([A-Za-z0-9-]+)                              Letters, numbers and hyphens
                                            (d{1,2}/d{1,2}/d{4})                    Date (e.g. 21/3/2006)
Assertions
                                            ([^s]+(?=.(jpg|gif|png)).2)              jpg, gif or png image
?=               Lookahead assertion        (^[1-9]{1}$|^[1-4]{1}[0-9]{1}$|^50$)         Any number from 1 to 50 inclusive
?!               Negative lookahead         (#?([A-Fa-f0-9]){3}(([A-Fa-f0-9]){3})?)      Valid hexadecimal colour code
?<=              Lookbehind assertion       ((?=.*d)(?=.*[a-z])(?=.*[A-Z]).{8,15})      String with at least one upper case
?!= or ?<!       Negative lookbehind                                                     letter, one lower case letter, and one
?>               Once-only Subexpression                                                 digit (useful for passwords).
?()              Condition [if then]        (w+@[a-zA-Z_]+?.[a-zA-Z]{2,6})             Email addresses
?()|             Condition [if then else]   (<(/?[^>]+)>)                             HTML Tags
?#               Comment
                                            Note: These patterns are intended for reference purposes and have not been
                                            extensively tested. Please use with caution and test thoroughly before use.
             Available free from
          www.ILoveJackDaniels.com

More Related Content

Viewers also liked (13)

PPTX
Evaluacion trimestral
raquel
 
PPTX
Materi kuliah 09 sort part 4
Budi Yono
 
DOCX
Ds u1 id_luhr
pantro756
 
PPTX
Herramientas de calculo
cefaloga
 
DOCX
Ficha+para+mantenimiento
Manuela Salazar Velilla
 
DOCX
10 guia redes 5 conceptos de redes 1 (1)
Manuela Salazar Velilla
 
DOCX
Ms 65 marketing of services
smumbahelp
 
PDF
Bail application
Siddharth Badkul
 
ODP
QRMailBox portachiavi facile da ritrovare.
Carmelo Carchedi
 
PPSX
Jere douglas2
Jere Douglas
 
PPTX
Las mujeres en la química
Andres Martin
 
PPTX
книга за 60 дней
moksellegroup
 
PPTX
Datavisualisatie voor journalisten persacademie
maartenzam
 
Evaluacion trimestral
raquel
 
Materi kuliah 09 sort part 4
Budi Yono
 
Ds u1 id_luhr
pantro756
 
Herramientas de calculo
cefaloga
 
Ficha+para+mantenimiento
Manuela Salazar Velilla
 
10 guia redes 5 conceptos de redes 1 (1)
Manuela Salazar Velilla
 
Ms 65 marketing of services
smumbahelp
 
Bail application
Siddharth Badkul
 
QRMailBox portachiavi facile da ritrovare.
Carmelo Carchedi
 
Jere douglas2
Jere Douglas
 
Las mujeres en la química
Andres Martin
 
книга за 60 дней
moksellegroup
 
Datavisualisatie voor journalisten persacademie
maartenzam
 

Similar to Regexps (20)

PDF
Regex cheatsheet
Nont Banditwong
 
PDF
perl-regexp-refcard-a4
tutorialsruby
 
PDF
perl-regexp-refcard-a4
tutorialsruby
 
PPT
Perl Intro 5 Regex Matches And Substitutions
Shaun Griffith
 
KEY
Andrei's Regex Clinic
Andrei Zmievski
 
PDF
Maxbox starter20
Max Kleiner
 
PDF
Regexp secrets
Hiro Asari
 
KEY
Regular expressions
James Gray
 
PPT
Introduction to Regular Expressions RootsTech 2013
Ben Brumfield
 
PPTX
Regular expressions
Thomas Langston
 
PPT
Regular Expressions
Satya Narayana
 
DOCX
Quick start reg ex
V krishnamoorthy
 
PDF
Regular expressions quick reference
jvinhit
 
PDF
PHP Cheatsheet
Nuuktal Consulting
 
KEY
正規表現のいろは
Ayumu Hanba
 
ZIP
Advanced Regular Expressions Redux
Jakub Nesetril
 
PDF
Python (regular expression)
Chirag Shetty
 
PDF
this is ruby test
51 lecture
 
PPT
Textpad and Regular Expressions
OCSI
 
PDF
A regex ekon16
Max Kleiner
 
Regex cheatsheet
Nont Banditwong
 
perl-regexp-refcard-a4
tutorialsruby
 
perl-regexp-refcard-a4
tutorialsruby
 
Perl Intro 5 Regex Matches And Substitutions
Shaun Griffith
 
Andrei's Regex Clinic
Andrei Zmievski
 
Maxbox starter20
Max Kleiner
 
Regexp secrets
Hiro Asari
 
Regular expressions
James Gray
 
Introduction to Regular Expressions RootsTech 2013
Ben Brumfield
 
Regular expressions
Thomas Langston
 
Regular Expressions
Satya Narayana
 
Quick start reg ex
V krishnamoorthy
 
Regular expressions quick reference
jvinhit
 
PHP Cheatsheet
Nuuktal Consulting
 
正規表現のいろは
Ayumu Hanba
 
Advanced Regular Expressions Redux
Jakub Nesetril
 
Python (regular expression)
Chirag Shetty
 
this is ruby test
51 lecture
 
Textpad and Regular Expressions
OCSI
 
A regex ekon16
Max Kleiner
 
Ad

Recently uploaded (20)

PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
Python basic programing language for automation
DanialHabibi2
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Ad

Regexps

  • 1. Anchors Quantifiers Groups and Ranges ^ Start of string * 0 or more . Any character except A Start of string + 1 or more new line (n) $ End of string ? 0 or 1 (a|b) a or b Z End of string {3} Exactly 3 (...) Group b Word boundary {3,} 3 or more (?:...) Passive Group B Not word boundary {3,5} 3, 4 or 5 [abc] Range (a or b or c) < Start of word [^abc] Not a or b or c > End of word [a-q] Letter between a and q Quantifier Modifiers [A-Q] Upper case letter "x" below represents a quantifier between A and Q Character Classes x? [0-7] Digit between 0 and 7 Ungreedy version of "x" n nth group/subpattern c Control character Note: Ranges are inclusive. s White space Escape Character S Not white space d Digit Pattern Modifiers Escape Character D Not digit w g Global match Word W Metacharacters (must be escaped) i Case-insensitive Not word x m Multiple lines Hexadecimal digit ^ [ . s Treat string as single line O Octal digit $ { * x Allow comments and ( + white space in pattern POSIX ) | ? e Evaluate replacement < > U Ungreedy pattern [:upper:] Upper case letters [:lower:] Lower case letters [:alpha:] All letters Special Characters String Replacement (Backreferences) [:alnum:] Digits and letters [:digit:] Digits n New line $n nth non-passive group [:xdigit:] Hexadecimal digits r Carriage return $2 "xyz" in /^(abc(xyz))$/ [:punct:] Punctuation t Tab $1 "xyz" in /^(?:abc)(xyz)$/ [:blank:] Space and tab v Vertical tab $` Before matched string [:space:] Blank characters f Form feed $' After matched string [:cntrl:] Control characters xxx Octal character xxx $+ Last matched string [:graph:] Printed characters xhh Hex character hh $& Entire matched string [:print:] Printed characters and spaces Sample Patterns [:word:] Digits, letters and underscore Pattern Will Match ([A-Za-z0-9-]+) Letters, numbers and hyphens (d{1,2}/d{1,2}/d{4}) Date (e.g. 21/3/2006) Assertions ([^s]+(?=.(jpg|gif|png)).2) jpg, gif or png image ?= Lookahead assertion (^[1-9]{1}$|^[1-4]{1}[0-9]{1}$|^50$) Any number from 1 to 50 inclusive ?! Negative lookahead (#?([A-Fa-f0-9]){3}(([A-Fa-f0-9]){3})?) Valid hexadecimal colour code ?<= Lookbehind assertion ((?=.*d)(?=.*[a-z])(?=.*[A-Z]).{8,15}) String with at least one upper case ?!= or ?<! Negative lookbehind letter, one lower case letter, and one ?> Once-only Subexpression digit (useful for passwords). ?() Condition [if then] (w+@[a-zA-Z_]+?.[a-zA-Z]{2,6}) Email addresses ?()| Condition [if then else] (<(/?[^>]+)>) HTML Tags ?# Comment Note: These patterns are intended for reference purposes and have not been extensively tested. Please use with caution and test thoroughly before use. Available free from www.ILoveJackDaniels.com