SlideShare una empresa de Scribd logo
1 de 1
Descargar para leer sin conexión
Regular Expressions - Quick Reference Guide
Anchors                              Literal Characters
^
                                                                                                     Character group contents
        start of line
$       end of line                  Letters and digits match exactly             axB70              x          individual chars
b      word boundary                Some special characters match exactly        @-=%               x-y        character range
B      not at word boundary                                                                         [:class:]  posix char class
A      start of subject
                                     Escape other specials with backslash         .  $ [
G      first match in subject
                                                                                                     [^:class:] negated class
z      end of subject               Character Groups
Z      end of subject               Almost any character (usually not newline)   .                  Examples
        or before newline at end                                                                     [a-zA-Z0-9_]
                                     Lists and ranges of characters               [ ]
Non-printing characters              Any character except those listed            [^ ]               [[:alnum:]_]
a        alarm (BEL, hex 07)
cx       "control-x"
e        escape (hex 1B)            Counts (add ? for non-greedy)                                   Comments
f        formfeed (hex 0C)          0 or more ("perhaps some")                     *                (?#comment)
n        newline (hex 0A)           0 or 1 ("perhaps a")                           ?
r        carriage return (hex OD)
t                                   1 or more ("some")                             +                Conditional subpatterns
          tab (hex 09)
ddd      octal code ddd             Between "n" and "m" of                         {n,m}            (?(condition)yes-pattern)
xhh      hex code hh                Exactly "n", "n" or more                       {n}, {n,}        (?(condition)yes|no-pattern)
x{hhh..} hex code hhh..

Generic character types              Alternation                                                     Recursive patterns
d      decimal digit                Either/or                                       |               (?n)         Numbered
D      not a decimal digit                                                                          (?0) (?R)    Entire regex
s      whitespace character
S                                   Lookahead and Lookbehind                                        (?&name)     Named
        not a whitespace char
w      "word" character             Followed by                                    (?= )
W      "non-word" character         NOT followed by                                (?! )            Replacements
POSIX character classes              Following                                    (?<= )             $n   reference capture
alnum letters and digits             NOT following                                (?<! )
alpha  letters                                                                                       Case foldings
ascii  character codes 0-127
blank                                Grouping                                                        u   upper case next char
       space or tab only
cntrl  control characters            For capture and counts                       ( )                U   upper case following
digit  decimal digits                Non-capturing                                (?: )              l   lower case next char
graph  printing chars -space                                                                         L   lower case following
lower  lower case letters
                                     Named captures                               (?<name>       )
print  printing chars +space         Alternation                                                     E   end case folding
punct  printing chars -alnum         Back references
space white space                                                                                    Conditional insertions
upper
                                     Numbered                                     n gn g{n}
       upper case letters                                                                            (?n:insertion)
word   "word" characters             Relative                                     g{-n}
xdigit hexadecimal digits            Named                                        k<name>           (?n:insertion:otherwise)
                                                                                                       http://www.e-texteditor.com

Más contenido relacionado

La actualidad más candente

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
TO THE NEW | Technology
 
HBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseHBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBase
enissoz
 

La actualidad más candente (20)

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Aggregator Leaf Tailer: Bringing Data to Your Users with Ultra Low Latency
Aggregator Leaf Tailer: Bringing Data to Your Users with Ultra Low LatencyAggregator Leaf Tailer: Bringing Data to Your Users with Ultra Low Latency
Aggregator Leaf Tailer: Bringing Data to Your Users with Ultra Low Latency
 
Deep Dive on Amazon DynamoDB
Deep Dive on Amazon DynamoDB Deep Dive on Amazon DynamoDB
Deep Dive on Amazon DynamoDB
 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHP
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...
Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...
Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
css.ppt
css.pptcss.ppt
css.ppt
 
HBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseHBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBase
 
Mongo DB Presentation
Mongo DB PresentationMongo DB Presentation
Mongo DB Presentation
 
MongoDB Sharding
MongoDB ShardingMongoDB Sharding
MongoDB Sharding
 
SQL to NoSQL Best Practices with Amazon DynamoDB - AWS July 2016 Webinar Se...
SQL to NoSQL   Best Practices with Amazon DynamoDB - AWS July 2016 Webinar Se...SQL to NoSQL   Best Practices with Amazon DynamoDB - AWS July 2016 Webinar Se...
SQL to NoSQL Best Practices with Amazon DynamoDB - AWS July 2016 Webinar Se...
 
Introduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerIntroduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizer
 
Css
CssCss
Css
 
MongoDB Aggregation Performance
MongoDB Aggregation PerformanceMongoDB Aggregation Performance
MongoDB Aggregation Performance
 
Intro to HBase Internals & Schema Design (for HBase users)
Intro to HBase Internals & Schema Design (for HBase users)Intro to HBase Internals & Schema Design (for HBase users)
Intro to HBase Internals & Schema Design (for HBase users)
 
Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
Amazon DynamoDB Deep Dive Advanced Design Patterns for DynamoDB (DAT401) - AW...
Amazon DynamoDB Deep Dive Advanced Design Patterns for DynamoDB (DAT401) - AW...Amazon DynamoDB Deep Dive Advanced Design Patterns for DynamoDB (DAT401) - AW...
Amazon DynamoDB Deep Dive Advanced Design Patterns for DynamoDB (DAT401) - AW...
 
Flink Forward Berlin 2017: Aris Kyriakos Koliopoulos - Drivetribe's Kappa Arc...
Flink Forward Berlin 2017: Aris Kyriakos Koliopoulos - Drivetribe's Kappa Arc...Flink Forward Berlin 2017: Aris Kyriakos Koliopoulos - Drivetribe's Kappa Arc...
Flink Forward Berlin 2017: Aris Kyriakos Koliopoulos - Drivetribe's Kappa Arc...
 

Destacado (11)

CloudStack 4.1, 4.2 and beyond
CloudStack 4.1, 4.2 and beyondCloudStack 4.1, 4.2 and beyond
CloudStack 4.1, 4.2 and beyond
 
MySQL Multi-Master Replication Using Tungsten Replicator 2.0.5
MySQL Multi-Master Replication Using Tungsten Replicator 2.0.5MySQL Multi-Master Replication Using Tungsten Replicator 2.0.5
MySQL Multi-Master Replication Using Tungsten Replicator 2.0.5
 
การประมูลหมายเลขทะเบียนรถ
การประมูลหมายเลขทะเบียนรถการประมูลหมายเลขทะเบียนรถ
การประมูลหมายเลขทะเบียนรถ
 
Svn workflow
Svn workflowSvn workflow
Svn workflow
 
Regular expressions-cheat-sheet-v2
Regular expressions-cheat-sheet-v2Regular expressions-cheat-sheet-v2
Regular expressions-cheat-sheet-v2
 
Smart Industry Newsletter Vol.26
Smart Industry Newsletter Vol.26Smart Industry Newsletter Vol.26
Smart Industry Newsletter Vol.26
 
งานนำเสนอ Linux
งานนำเสนอ  Linuxงานนำเสนอ  Linux
งานนำเสนอ Linux
 
Oss for-biz
Oss for-bizOss for-biz
Oss for-biz
 
Hacking apache cloud stack
Hacking apache cloud stackHacking apache cloud stack
Hacking apache cloud stack
 
The Future of Apache CloudStack (Not So Cloudy) (Collab 2012)
The Future of Apache CloudStack (Not So Cloudy) (Collab 2012)The Future of Apache CloudStack (Not So Cloudy) (Collab 2012)
The Future of Apache CloudStack (Not So Cloudy) (Collab 2012)
 
Php & mysql
Php & mysqlPhp & mysql
Php & mysql
 

Similar a Regex cheatsheet (20)

Regexps
RegexpsRegexps
Regexps
 
Expresiones Regulares
Expresiones RegularesExpresiones Regulares
Expresiones Regulares
 
slide share test
slide share testslide share test
slide share test
 
mhg
mhgmhg
mhg
 
Regular expressions quick reference
Regular expressions quick referenceRegular expressions quick reference
Regular expressions quick reference
 
An Introduction to Regular expressions
An Introduction to Regular expressionsAn Introduction to Regular expressions
An Introduction to Regular expressions
 
test vedio
test vediotest vedio
test vedio
 
qwdeqwe
qwdeqweqwdeqwe
qwdeqwe
 
Added to test pdf
Added to test pdf Added to test pdf
Added to test pdf
 
added for test
added for test added for test
added for test
 
ganesh testing
ganesh testing ganesh testing
ganesh testing
 
now its pdf
now its pdfnow its pdf
now its pdf
 
fghfghf
fghfghffghfghf
fghfghf
 
The hindu
The hinduThe hindu
The hindu
 
Video added by Normal user
Video added by Normal user Video added by Normal user
Video added by Normal user
 
Resource one
Resource one Resource one
Resource one
 
om
omom
om
 
Added to test pdf
Added to test pdf Added to test pdf
Added to test pdf
 
dasdasd
dasdasddasdasd
dasdasd
 
estset
estsetestset
estset
 

Regex cheatsheet

  • 1. Regular Expressions - Quick Reference Guide Anchors Literal Characters ^ Character group contents start of line $ end of line Letters and digits match exactly axB70 x individual chars b word boundary Some special characters match exactly @-=% x-y character range B not at word boundary [:class:] posix char class A start of subject Escape other specials with backslash . $ [ G first match in subject [^:class:] negated class z end of subject Character Groups Z end of subject Almost any character (usually not newline) . Examples or before newline at end [a-zA-Z0-9_] Lists and ranges of characters [ ] Non-printing characters Any character except those listed [^ ] [[:alnum:]_] a alarm (BEL, hex 07) cx "control-x" e escape (hex 1B) Counts (add ? for non-greedy) Comments f formfeed (hex 0C) 0 or more ("perhaps some") * (?#comment) n newline (hex 0A) 0 or 1 ("perhaps a") ? r carriage return (hex OD) t 1 or more ("some") + Conditional subpatterns tab (hex 09) ddd octal code ddd Between "n" and "m" of {n,m} (?(condition)yes-pattern) xhh hex code hh Exactly "n", "n" or more {n}, {n,} (?(condition)yes|no-pattern) x{hhh..} hex code hhh.. Generic character types Alternation Recursive patterns d decimal digit Either/or | (?n) Numbered D not a decimal digit (?0) (?R) Entire regex s whitespace character S Lookahead and Lookbehind (?&name) Named not a whitespace char w "word" character Followed by (?= ) W "non-word" character NOT followed by (?! ) Replacements POSIX character classes Following (?<= ) $n reference capture alnum letters and digits NOT following (?<! ) alpha letters Case foldings ascii character codes 0-127 blank Grouping u upper case next char space or tab only cntrl control characters For capture and counts ( ) U upper case following digit decimal digits Non-capturing (?: ) l lower case next char graph printing chars -space L lower case following lower lower case letters Named captures (?<name> ) print printing chars +space Alternation E end case folding punct printing chars -alnum Back references space white space Conditional insertions upper Numbered n gn g{n} upper case letters (?n:insertion) word "word" characters Relative g{-n} xdigit hexadecimal digits Named k<name> (?n:insertion:otherwise) http://www.e-texteditor.com