SlideShare ist ein Scribd-Unternehmen logo
1 von 3
Downloaden Sie, um offline zu lesen
Use To match any character
[set] In that set
[^set] Not in that set
[a–z] In the a-z range
[^a–z] Not in the a-z range
. Any except n (new line)
char Escaped special character
Use To match Unicode
t Horizontal tab u0009
v Vertical tab u000B
b Backspace u0008
e Escape u001B
r Carriage return u000D
f Form feed u000C
n New line u000A
a Bell (alarm) u0007
c char ASCII control
character

Use To match character with
octal 2-3 digit octal character code
x hex 2-digit hex character code
u hex 4-digit hex character code
Use To match character
p{ctgry} In that Unicode category or block
P{ctgry} Not in that Unicode category or
block
w Word character
W Non-word character
d Decimal digit
D Not a decimal digit
s White-space character
S Non-white-space char
Greedy Lazy Matches
* *? 0 or more times
+ +? 1 or more times
? ?? 0 or 1 time
{n} {n}? Exactly n times
{n,} {n,}? At least n times
{n,m} {n,m}? From n to m times
Use To specify position
^ At start of string or line
A At start of string
z At end of string
Z At end (or before n at end) of string
$ At end (or before n at end) of string
or line
G Where previous match ended
b On word boundary
B Not on word boundary
Use To define
(exp) Indexed group
(?<name>exp) Named group
(?<name1-
name2>exp)
Balancing group
(?:exp) Noncapturing group
(?=exp) Zero-width positive
lookahead
(?!exp) Zero-width negative
lookahead
(?<=exp) Zero-width positive
lookbehind
(?<!exp) Zero-width negative
lookbehind
(?>exp) Non-backtracking (greedy)
Option Effect on match
i Case-insensitive
m Multiline mode
n Explicit (named)
s Single-line mode
x Ignore white space
Use To
(?imnsx-
imnsx)
Set or disable the specified
options
(?imnsx-
imnsx:exp)
Set or disable the specified
options within the
expression
June 2014
 2014 Microsoft. All rights reserved.
Use To match
n Indexed group
k<name> Named group
Use To match
a |b Either a or b
(?(exp)
yes | no)
yes if exp is matched
no if exp isn't matched
(?(name)
yes | no)
yes if name is matched
no if name isn't matched
Use To substitute
$n Substring matched by group
number n
${name} Substring matched by group
name
$$ Literal $ character
$& Copy of whole match
$` Text before the match
$' Text after the match
$+ Last captured group
$_ Entire input string
Use To
(?# comment) Add inline comment
# Add x-mode comment
For detailed information and examples, see
http://aka.ms/regex
To test your regular expressions, see
http://regexlib.com/RETester.aspx
Category Description
Lu Letter, uppercase
LI Letter, lowercase
Lt Letter, title case
Lm Letter, modifier
Lo Letter, other
L Letter, all
Mn Mark, nonspacing combining
Mc Mark, spacing combining
Me Mark, enclosing combining
M Mark, all diacritic
Nd Number, decimal digit
Nl Number, letterlike
No Number, other
N Number, all
Pc Punctuation, connector
Pd Punctuation, dash
Ps Punctuation, opening mark
Pe Punctuation, closing mark
Pi Punctuation, initial quote mark
Pf Puntuation, final quote mark
Po Punctuation, other
P Punctuation, all
Sm Symbol, math
Sc Symbol, currency
Sk Symbol, modifier
So Symbol, other
S Symbol, all
Zs Separator, space
Zl Separator, line
Zp Separator, paragraph
Z Separator, all
Cc Control code
Cf Format control character
Cs Surrogate code point
Co Private-use character
Cn Unassigned
C Control characters, all
For named character set blocks (e.g., Cyrillic), search
for "supported named blocks" in the MSDN Library.
Class: System.Text.RegularExpressions.Regex
Pattern matching with Regex objects
To initialize with Use constructor
Regular exp Regex(String)
+ options Regex(String, RegexOptions)
+ time-out Regex(String, RegexOptions,
TimeSpan)
Pattern matching with static methods
Use an overload of a method below to supply the
regular expression and the text you want to search.
Finding and replacing matched patterns
To Use method
Validate match Regex.IsMatch
Retrieve single
match
Regex.Match (first)
Match.NextMatch (next)
Retrieve all
matches
Regex.Matches
Replace match Regex.Replace
Divide text Regex.Split
Handle char
escapes
Regex.Escape
Regex.Unescape
Getting info about regular expression patterns
To get Use Regex API
Group names GetGroupNames
GetGroupNameFromNumber
Group numbers GetGroupNumbers
GetGroupNumberFromName
Expression ToString
Options Options
Time-out MatchTimeOut
Cache size CacheSize
Direction RightToLeft
Regular expressions quick reference

Weitere ähnliche Inhalte

Was ist angesagt?

Regex Presentation
Regex PresentationRegex Presentation
Regex Presentationarnolambert
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsRaj Gupta
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsBrij Kishore
 
Regular expression
Regular expressionRegular expression
Regular expressionRajon
 
Regular Expression
Regular ExpressionRegular Expression
Regular ExpressionLambert Lum
 
Java: Regular Expression
Java: Regular ExpressionJava: Regular Expression
Java: Regular ExpressionMasudul Haque
 
16 Java Regex
16 Java Regex16 Java Regex
16 Java Regexwayn
 
Textpad and Regular Expressions
Textpad and Regular ExpressionsTextpad and Regular Expressions
Textpad and Regular ExpressionsOCSI
 
Finaal application on regular expression
Finaal application on regular expressionFinaal application on regular expression
Finaal application on regular expressionGagan019
 
Introduction to regular expressions
Introduction to regular expressionsIntroduction to regular expressions
Introduction to regular expressionsBen Brumfield
 
Regular Expression
Regular ExpressionRegular Expression
Regular ExpressionBharat17485
 
Python (regular expression)
Python (regular expression)Python (regular expression)
Python (regular expression)Chirag Shetty
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular ExpressionsMukesh Tekwani
 
Regular Expressions grep and egrep
Regular Expressions grep and egrepRegular Expressions grep and egrep
Regular Expressions grep and egrepTri Truong
 
The Power of Regular Expression: use in notepad++
The Power of Regular Expression: use in notepad++The Power of Regular Expression: use in notepad++
The Power of Regular Expression: use in notepad++Anjesh Tuladhar
 

Was ist angesagt? (20)

Regex Presentation
Regex PresentationRegex Presentation
Regex Presentation
 
Andrei's Regex Clinic
Andrei's Regex ClinicAndrei's Regex Clinic
Andrei's Regex Clinic
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regular expression
Regular expressionRegular expression
Regular expression
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regex cheatsheet
Regex cheatsheetRegex cheatsheet
Regex cheatsheet
 
Java: Regular Expression
Java: Regular ExpressionJava: Regular Expression
Java: Regular Expression
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
16 Java Regex
16 Java Regex16 Java Regex
16 Java Regex
 
Textpad and Regular Expressions
Textpad and Regular ExpressionsTextpad and Regular Expressions
Textpad and Regular Expressions
 
Finaal application on regular expression
Finaal application on regular expressionFinaal application on regular expression
Finaal application on regular expression
 
Introduction to regular expressions
Introduction to regular expressionsIntroduction to regular expressions
Introduction to regular expressions
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
Python (regular expression)
Python (regular expression)Python (regular expression)
Python (regular expression)
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular Expressions
 
Regular Expressions grep and egrep
Regular Expressions grep and egrepRegular Expressions grep and egrep
Regular Expressions grep and egrep
 
The Power of Regular Expression: use in notepad++
The Power of Regular Expression: use in notepad++The Power of Regular Expression: use in notepad++
The Power of Regular Expression: use in notepad++
 

Andere mochten auch

Diabetes Health Reminders
Diabetes Health RemindersDiabetes Health Reminders
Diabetes Health Remindersdrglasgow2013
 
Diabetes Health Reminders
Diabetes Health RemindersDiabetes Health Reminders
Diabetes Health Remindersdrglasgow2013
 
2013캄보디아
2013캄보디아2013캄보디아
2013캄보디아christmh
 
Chươngii
ChươngiiChươngii
Chươngiijvinhit
 
Live stream from myoStream
Live stream from myoStreamLive stream from myoStream
Live stream from myoStreammyostream
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldabaux singapore
 

Andere mochten auch (8)

Diabetes Health Reminders
Diabetes Health RemindersDiabetes Health Reminders
Diabetes Health Reminders
 
Diabetes Health Reminders
Diabetes Health RemindersDiabetes Health Reminders
Diabetes Health Reminders
 
2013캄보디아
2013캄보디아2013캄보디아
2013캄보디아
 
Vemma
VemmaVemma
Vemma
 
Chươngii
ChươngiiChươngii
Chươngii
 
Live stream from myoStream
Live stream from myoStreamLive stream from myoStream
Live stream from myoStream
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
 
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job? Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
 

Ähnlich wie Regular expressions quick reference (20)

mhg
mhgmhg
mhg
 
An Introduction to Regular expressions
An Introduction to Regular expressionsAn Introduction to Regular expressions
An Introduction to Regular expressions
 
Regular expressions in oracle
Regular expressions in oracleRegular expressions in oracle
Regular expressions in oracle
 
Regexps
RegexpsRegexps
Regexps
 
Expresiones Regulares
Expresiones RegularesExpresiones Regulares
Expresiones Regulares
 
Adv. python regular expression by Rj
Adv. python regular expression by RjAdv. python regular expression by Rj
Adv. python regular expression by Rj
 
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
 
Added to test pdf
Added to test pdf Added to test pdf
Added to test pdf
 
dasdasd
dasdasddasdasd
dasdasd
 
estset
estsetestset
estset
 
1377874234 eeeeeeeeeeeeeeeor more file
1377874234 eeeeeeeeeeeeeeeor more file1377874234 eeeeeeeeeeeeeeeor more file
1377874234 eeeeeeeeeeeeeeeor more file
 
Ganesh added
Ganesh added Ganesh added
Ganesh added
 

Mehr von jvinhit

Web performance fundamental
Web performance fundamentalWeb performance fundamental
Web performance fundamentaljvinhit
 
CSS Căn bản
CSS Căn bảnCSS Căn bản
CSS Căn bảnjvinhit
 
Using The CSharp Sockets Helper Classes
Using The CSharp Sockets Helper ClassesUsing The CSharp Sockets Helper Classes
Using The CSharp Sockets Helper Classesjvinhit
 
Network Programming in C#
Network Programming in C#Network Programming in C#
Network Programming in C#jvinhit
 
Xử lý ảnh
Xử lý ảnhXử lý ảnh
Xử lý ảnhjvinhit
 
Delegate và event trong C#
Delegate và event trong C#Delegate và event trong C#
Delegate và event trong C#jvinhit
 
Store procedure
Store procedureStore procedure
Store procedurejvinhit
 

Mehr von jvinhit (7)

Web performance fundamental
Web performance fundamentalWeb performance fundamental
Web performance fundamental
 
CSS Căn bản
CSS Căn bảnCSS Căn bản
CSS Căn bản
 
Using The CSharp Sockets Helper Classes
Using The CSharp Sockets Helper ClassesUsing The CSharp Sockets Helper Classes
Using The CSharp Sockets Helper Classes
 
Network Programming in C#
Network Programming in C#Network Programming in C#
Network Programming in C#
 
Xử lý ảnh
Xử lý ảnhXử lý ảnh
Xử lý ảnh
 
Delegate và event trong C#
Delegate và event trong C#Delegate và event trong C#
Delegate và event trong C#
 
Store procedure
Store procedureStore procedure
Store procedure
 

Kürzlich hochgeladen

Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Sapana Sha
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Colleen Farrelly
 
Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 217djon017
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Jack DiGiovanna
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024thyngster
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceSapana Sha
 
DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfJohn Sterrett
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFAAndrei Kaleshka
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfchwongval
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdfHuman37
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一fhwihughh
 
MK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxMK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxUnduhUnggah1
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...Florian Roscheck
 

Kürzlich hochgeladen (20)

Call Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort ServiceCall Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort Service
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
 
Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024
 
Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts Service
 
DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdf
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFA
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdf
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
 
MK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxMK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docx
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
 

Regular expressions quick reference

  • 1. Use To match any character [set] In that set [^set] Not in that set [a–z] In the a-z range [^a–z] Not in the a-z range . Any except n (new line) char Escaped special character Use To match Unicode t Horizontal tab u0009 v Vertical tab u000B b Backspace u0008 e Escape u001B r Carriage return u000D f Form feed u000C n New line u000A a Bell (alarm) u0007 c char ASCII control character  Use To match character with octal 2-3 digit octal character code x hex 2-digit hex character code u hex 4-digit hex character code Use To match character p{ctgry} In that Unicode category or block P{ctgry} Not in that Unicode category or block w Word character W Non-word character d Decimal digit D Not a decimal digit s White-space character S Non-white-space char Greedy Lazy Matches * *? 0 or more times + +? 1 or more times ? ?? 0 or 1 time {n} {n}? Exactly n times {n,} {n,}? At least n times {n,m} {n,m}? From n to m times Use To specify position ^ At start of string or line A At start of string z At end of string Z At end (or before n at end) of string $ At end (or before n at end) of string or line G Where previous match ended b On word boundary B Not on word boundary Use To define (exp) Indexed group (?<name>exp) Named group (?<name1- name2>exp) Balancing group (?:exp) Noncapturing group (?=exp) Zero-width positive lookahead (?!exp) Zero-width negative lookahead (?<=exp) Zero-width positive lookbehind (?<!exp) Zero-width negative lookbehind (?>exp) Non-backtracking (greedy) Option Effect on match i Case-insensitive m Multiline mode n Explicit (named) s Single-line mode x Ignore white space Use To (?imnsx- imnsx) Set or disable the specified options (?imnsx- imnsx:exp) Set or disable the specified options within the expression June 2014  2014 Microsoft. All rights reserved.
  • 2. Use To match n Indexed group k<name> Named group Use To match a |b Either a or b (?(exp) yes | no) yes if exp is matched no if exp isn't matched (?(name) yes | no) yes if name is matched no if name isn't matched Use To substitute $n Substring matched by group number n ${name} Substring matched by group name $$ Literal $ character $& Copy of whole match $` Text before the match $' Text after the match $+ Last captured group $_ Entire input string Use To (?# comment) Add inline comment # Add x-mode comment For detailed information and examples, see http://aka.ms/regex To test your regular expressions, see http://regexlib.com/RETester.aspx Category Description Lu Letter, uppercase LI Letter, lowercase Lt Letter, title case Lm Letter, modifier Lo Letter, other L Letter, all Mn Mark, nonspacing combining Mc Mark, spacing combining Me Mark, enclosing combining M Mark, all diacritic Nd Number, decimal digit Nl Number, letterlike No Number, other N Number, all Pc Punctuation, connector Pd Punctuation, dash Ps Punctuation, opening mark Pe Punctuation, closing mark Pi Punctuation, initial quote mark Pf Puntuation, final quote mark Po Punctuation, other P Punctuation, all Sm Symbol, math Sc Symbol, currency Sk Symbol, modifier So Symbol, other S Symbol, all Zs Separator, space Zl Separator, line Zp Separator, paragraph Z Separator, all Cc Control code Cf Format control character Cs Surrogate code point Co Private-use character Cn Unassigned C Control characters, all For named character set blocks (e.g., Cyrillic), search for "supported named blocks" in the MSDN Library. Class: System.Text.RegularExpressions.Regex Pattern matching with Regex objects To initialize with Use constructor Regular exp Regex(String) + options Regex(String, RegexOptions) + time-out Regex(String, RegexOptions, TimeSpan) Pattern matching with static methods Use an overload of a method below to supply the regular expression and the text you want to search. Finding and replacing matched patterns To Use method Validate match Regex.IsMatch Retrieve single match Regex.Match (first) Match.NextMatch (next) Retrieve all matches Regex.Matches Replace match Regex.Replace Divide text Regex.Split Handle char escapes Regex.Escape Regex.Unescape Getting info about regular expression patterns To get Use Regex API Group names GetGroupNames GetGroupNameFromNumber Group numbers GetGroupNumbers GetGroupNumberFromName Expression ToString Options Options Time-out MatchTimeOut Cache size CacheSize Direction RightToLeft