RegularExpressionPatternMatching
Wheneditingcomparisoncriteria,thefollowingregularexpressionscanbeused
forpatternmatching.Examplesareprovidedattheendofthissection.
Characters
Character
Description
Example
Anycharacter
except
[,\,^,$,.,|,?,*,+,
(,),
Allcharactersexceptthelistedspecial
charactersmatchasingleinstanceof
themselves.
amatchesa
\(backslash)
followedby
anyof
[,\,^,$,.,|,?,*,+,
(,),
Abackslashescapesspecialcharactersto
suppresstheirspecialmeaning.
\+matches+
\xFFwhereFF
are2
hexadecimal
digits
Matchesthecharacterwiththespecified
ASCII/ANSIvalue,whichdependsonthe
codepageused.Canbeusedincharacter
classes.
\xA9matches©
whenusingthe
Latin-1code
page.
\n,\rand\t
MatchanLFcharacter,CRcharacteranda
tabcharacterrespectively.Canbeusedin
characterclasses.
\r\nmatchesa
DOS/Windows
CRLFline
break.
791
RegularExpressionPatternMatching
Pdf form save with reader - extract form data from PDF in C#.net, ASP.NET, MVC, Ajax, WPF
Help to Read and Extract Field Data from PDF with a Convenient C# Solution
collect data from pdf forms; extract pdf form data to excel
Pdf form save with reader - VB.NET PDF Form Data Read library: extract form data from PDF in vb.net, ASP.NET, MVC, Ajax, WPF
Convenient VB.NET Solution to Read and Extract Field Data from PDF
pdf form save in reader; exporting pdf data to excel
AppendixA:References
CharacterClassesorCharacterSets[abc]
Character
Classesor
Sets
Description
Example
[ (opening
square
bracket)
Startsacharacterclass.Acharacterclass
matchesasinglecharacteroutofallofthe
possibilitiesofferedbythecharacterclass.Inside
acharacterclass,differentrulesapply.Therules
inthissectionareonlyvalidinsidecharacter
classes.Therulesoutsidethissectionarenot
validincharacterclasses,except\n,\r,\tand
\xFF
Any
character
except^,-,],\
addthat
characterto
thepossible
matchesfor
thecharacter
class.
Allcharactersexceptthelistedspecial
characters.
[abc]
matchesa,
borc
\(backslash)
followedby
anyof^,-,],\
Abackslashescapesspecialcharactersto
suppresstheirspecialmeaning.
[\^\]]
matches^
or]
-(hyphen)
except
immediately
afterthe
opening[
Specifiesarangeofcharacters.(Specifiesa
hyphenifplacedimmediatelyaftertheopening[)
[a-zA-Z0-9]
matches
anyletter
ordigit
792
C# PDF: PDF Document Viewer & Reader SDK for Windows Forms
SaveFile(String filePath): Save PDF document file to a specified path form (Here, we take a blank form as an open a file dialog and load your PDF document in
how to save pdf form data in reader; extract data from pdf file
VB.NET Image: How to Save Image & Print Image Using VB.NET
printing multi-page document files, like PDF and Word is used to illustrate how to save a sample RE__Test Public Partial Class Form1 Inherits Form Public Sub New
extracting data from pdf forms; extract pdf data into excel
Character
Classesor
Sets
Description
Example
^(caret)
immediately
afterthe
opening[
Negatesthecharacterclass,causingittomatcha
singlecharacternotlistedinthecharacterclass.
(Specifiesacaretifplacedanywhereexceptafter
theopening[)
[^a-d]
matchesx
(any
character
excepta,b,
cord)
\d,\wand\s
Shorthandcharacterclassesmatchingdigits0-9,
wordcharacters(lettersanddigits)and
whitespacerespectively.Canbeusedinsideand
outsidecharacterclasses
[\d\s]
matchesa
character
thatisa
digitor
whitespace
Anchors
Anchors
Description
Example
^(caret)
Matchesatthestartofthestringtowhichtheregular
expressionpatternisapplied.Matchesapositionrather
thanacharacter.Mostregularexpressionflavorshave
anoptiontomakethecaretmatchafterlinebreaks(i.e.
atthestartofalineinafile)aswell.
^.
matches
ain
abc\ndef.
Also
matches
din
"multi-
line"
mode.
793
 Anchors
C# PDF File Merge Library: Merge, append PDF files in C#.net, ASP.
Merge Microsoft Office Word, Excel and PowerPoint data to PDF form. Append one PDF file to the end of another and save to a single PDF file.
pdf form save with reader; export excel to pdf form
VB.NET PDF Page Delete Library: remove PDF pages in vb.net, ASP.
this RasterEdge XDoc.PDF SDK, you can simply delete a single page from a PDF document using VB.NET or remove any page from a PDF document and save to local
save data in pdf form reader; extracting data from pdf forms to excel
AppendixA:References
Anchors
Description
Example
$ (dollar) Matchesattheendofthestringtowhichtheregular
expressionpatternisapplied.Matchesapositionrather
thanacharacter.Mostregularexpressionflavorshave
anoptiontomakethedollarmatchbeforelinebreaks
(i.e.attheendofalineinafile)aswell.Alsomatches
beforetheverylastlinebreakifthestringendswitha
linebreak.
.$ 
matches
fin
abc\ndef.
Also
matches
cin
"multi-
line"
mode.
\A
Matchesatthestartofthestringtowhichtheregular
expressionpatternisappliedto.Matchesaposition
ratherthanacharacter.Nevermatchesafterlinebreaks.
\A.
matches
ainabc
\Z
Matchesattheendofthestringtowhichtheregular
expressionpatternisapplied.Matchesapositionrather
thanacharacter.Nevermatchesbeforelinebreaks,
exceptfortheverylastlinebreakifthestringendswith
alinebreak.
.\Z
matches
fin
abc\ndef
\z
Matchesattheendofthestringtowhichtheregular
expressionpatternisapplied.Matchesapositionrather
thanacharacter.Nevermatchesbeforelinebreaks.
.\z
matches
fin
abc\ndef
Quantifiers
Quantifiers
Description
Example
?(question
mark)
Makestheprecedingitemoptional.Theoptionalitem
isincludedinthematch,ifpossible.
abc?
matches
aborabc
794
C# PDF Page Extract Library: copy, paste, cut PDF pages in C#.net
to extract single or multiple pages from adobe PDF file and save into a The portable document format, known as PDF document, is a widely-used form of file
extract data from pdf table; how to extract data from pdf to excel
C# Image: Save or Print Document and Image in Web Viewer
or image, you can easily save the changes to DLL Library, including documents TIFF, PDF, Excel, Word string fileName = Request.Form["saveFileName"]; string fid
exporting data from pdf to excel; flatten pdf form in reader
Quantifiers
Description
Example
??
Makestheprecedingitemoptional.Theoptionalitem
isexcludedinthematch,ifpossible.Thisconstructis
oftenexcludedfromdocumentationduetoitslimited
use.
abc??
matches
aborabc
*(star)
Repeatsthepreviousitemzeroormoretimes.As
manyitemsaspossiblewillbematchedbeforetrying
permutationswithfewermatchesofthepreceding
item,uptothepointwheretheprecedingitemisnot
matchedatall.
.*
matches
"def"
"ghi"in
abc"def"
"ghi"jkl
*?(lazy
star)
Repeatsthepreviousitemzeroormoretimes.The
enginefirstattemptstoskipthepreviousitembefore
tryingpermutationswitheverincreasingmatchesof
theprecedingitem.
.*?
matches
"def"in
abc"def"
"ghi"jkl
+(plus)
Repeatsthepreviousitemonceormore.Asmany
itemsaspossiblewillbematchedbeforetrying
permutationswithfewermatchesofthepreceding
item,uptothepointwheretheprecedingitemis
matchedonlyonce.
.+
matches
"def"
"ghi"in
abc"def"
"ghi"jkl
+?(lazy
plus)
Repeatsthepreviousitemonceormore.Theengine
firstmatchesthepreviousitemonlyonce,before
tryingpermutationswitheverincreasingmatchesof
theprecedingitem.
.+?
matches
"def"in
abc"def"
"ghi"jkl
{n}wheren
isan
integer>=
1
Repeatsthepreviousitemexactlyntimes.
a{3}
matches
aaa
795
 Quantifiers
C# PDF Convert to Tiff SDK: Convert PDF to tiff images in C#.net
Description: Convert to DOCX/TIFF with specified zoom value and save it into stream. Parameters: zoomValue, The magnification of the original PDF page size.
filling out pdf forms with reader; extract data out of pdf file
C# Create PDF from Tiff Library to convert tif images to PDF in C#
Description: Convert to PDF and save it on the disk. Parameters: Name, Description, Valid Value. Description: Convert to PDF and save it into stream. Parameters:
how to save fillable pdf form in reader; pdf data extraction open source
AppendixA:References
Quantifiers
Description
Example
{n,m}
wheren>=
1andm>=
n
Repeatsthepreviousitembetweennandmtimes.
Willtrytorepeatmtimesbeforereducingthe
repetitiontontimes.
a{2,4}
matches
aa,aaa
oraaaa
{n,m}?
wheren>=
1andm>=
n
Repeatsthepreviousitembetweennandmtimes.
Willtrytorepeatntimesbeforeincreasingthe
repetitiontomtimes.
a{2,4}?
matches
aaaa,
aaaor
aa
{n,}where
n>=1
Repeatsthepreviousitematleastntimes.Willtryto
matchasmanyitemsaspossiblebeforetrying
permutationswithfewermatchesofthepreceding
item,uptothepointwheretheprecedingitemis
matchedonlymtimes.
a{2,}
matches
aaaaain
aaaaa
{n,}?where
n>=1
Repeatsthepreviousitembetweennandmtimes.
Theenginefirstmatchesthepreviousitemntimes
beforetryingpermutationswitheverincreasing
matchesoftheprecedingitem.
a{2,}?
matches
aain
aaaaa
Dot
Dot
Character
Description
Example
.(dot)
Matchesanysinglecharacterexceptline
breakcharacters\rand\n.
.matchesxormost
anyothercharacter
796
C# PDF Convert to Word SDK: Convert PDF to Word library in C#.net
key. Quick to remove watermark and save PDF text, image, table, hyperlink and bookmark to Word without losing format. Powerful components
exporting data from excel to pdf form; pdf form field recognition
C# Create PDF from PowerPoint Library to convert pptx, ppt to PDF
Description: Convert to PDF/TIFF and save it on the disk. Parameters: Description: Convert to PDF/TIFF and save it into stream. Parameters:
cannot save pdf form in reader; how to save a pdf form in reader
WordBoundaries
Word
Boundary
Description
Example
\b
Matchesatthepositionbetweenawordcharacter
(anythingmatchedby\w)andanon-wordcharacter
(anythingmatchedby[^\w]or\W)aswellasatthestart
and/orendofthestringifthefirstand/orlastcharacters
inthestringarewordcharacters.
.\b
matches
cinabc
\B
Matchesatthepositionbetweentwowordcharacters
(i.e.,thepositionbetween\w\w)aswellasatthe
positionbetweentwonon-wordcharacters(i.e.,\W\W).
\B.\B
matches
binabc
Alternation
Alternation
Character
Description
Example
|
(verticalbar
or“pipe”)
Causestheregularexpressionenginetomatch
eitherthepartontheleftsideorthepartonthe
rightside.Canbestrungtogetherintoaseriesof
options.
abc|def|xyz
matches
abc,defor
xyz
|
(verticalbar
or“pipe”)
Theverticalbarhasthelowestprecedenceofall
operators.Usegroupingtoalternateonlypartof
theregularexpression.
abc(def|xyz)
matches
abcdefor
abcxyz
RegularExpressionPatternMatchingExamples
Thefollowingexamplesillustrategeneralusesofregularexpressionpattern
matching.
snmp-servercommunitypublic
Findsanylinethatincludesthetextsnmp-servercommunitypublic.
Therecanbetextbeforeand/orafterthestringonthesameline.
797
 WordBoundaries
AppendixA:References
servicetcp-keepalives-in.*\n(.*\n)*.*servicetcp-keepalives-out
Findsthefirstlineservicetcp-keepalives-inandthenlooksforservice
tcp-keepalives-outonanylineafterthat.Theregularexpressionstring.*\n
(.*\n)*.*isusedtosearchanynumberoflinesbetweenstrings.
access-list105deny.*tcpanyanyeq139log
Findsthelinewithaccess-list105deny,followedbyanynumberof
charactersofanytype,followedbytcpanyanyeq139logonthesame
line.Theregularexpressionstring.*findsanycharacterandanynumberof
charactersonthesameline.Thisexpressioncanbeusedtofindspaces,
tabs,numbers,letters,orspecialcharacters.
ntpclock-period\d*
Findsanylinethatincludesntpclock-period,followedbyanynumber.The
regularexpressionstring\d*willfindanynumberatanylength,suchas3,
48,or2394887.
user\x2a
Findsanylinethatincludesuser*.Theregularexpressionstring\x,
followedbyahexadecimalvalue,specifiesanindividualcharacter.Inthis
example,\x2arepresentstheasteriskcharacter,whichhasahexadecimal
valueof2a.
ThefollowingexamplesillustratetheuseofSQLstringandregularexpression
patternmatchinginSyslogmessagesandrules.
WebConsoleandSyslogViewer(SearchMessagestab)
Regularexpressionsearchforsyslogmessagesisnotcurrentlysupported.
MatchingisonlyavailableonsimpleSQLstringpatterns,where?or_areused
toindicatesingle,replacedcharactersandwhere*or%areusedtoindicatezero
charactersortodelineatemultiplecharacters,asindicatedinthefollowing
examples:
IPAddressfilter:
l
192.168.74.*-IPaddressesinrange192.168.74.1 -
192.168.74.255
l
192.168.74.?(or192.168.74._)-IPaddressesinrange
192.168.74.1 - 192.168.74.9
798
l
*.168.74*(or%.168.74%)-IPaddressescontaining.168.74
l
%.74.25(or*.74.25)-IPaddressesendingwith.74.25
MessageTypefilter:
l
orion*(ororion%)-messagetypestartswith"orion"
l
message????-messagetypestartswith"message"plusany4symbols,
like"message1234"
l
%orion%(or*orion*)-messagetypecontains"orion"
MessagePatternfilter:
l
syslog message from 192.168.*-messagestartswith"syslog
message from 192.168."
l
*Server_ *messagescontainingtheword"Server"andanysymbol
beforethespace.
SyslogRules
SyslogrulesallowyoutofiltermatchingmessagesusingaRegexpatternor
simpleSQLstringpatterns,providedtheUseregularexpressionsoptionis
enabled.Regularexpressionsmaybeusedinsyslogmessagefiltering,as
follows:
DNSHostnamepattern
l
.*domain.com$-DNSnameendswithdomain.com
l
^Orion.*-DNSnamestartswithOrion.
l
.*Orion.*-DNSnamecontainsOrion
MessageTypePattern
l
^[A,B,C]-messagetypestartswithA,BorC.
l
^[0-9].*log$-messagetypestartswithnumbervaluefrom1to9and
endswithlog.
MessagePattern
l
.*[^0-9]10.0.0.1[^0-9].*-messagecontainsIPaddress
10.0.0.1
799
SyslogRules
AppendixA:References
l
^Orion.*[^0-9]10.0.0.1[^0-9].*messagestartswithOrionand
containsIPaddress10.0.0.1.
Note:".*"couldbeomittedatboththeendandthebeginningofthe
expression.
800
Documents you may be interested
Documents you may be interested