RegExLib.com Regular Expression Cheat Sheet (.NET)
文章推薦指數: 80 %
RegExLib.com Regular Expression Cheat Sheet (.NET). Metacharacters Defined. MChar, Definition. ^, Start of a string. RegExLib.comRegularExpressionCheatSheet(.NET) MetacharactersDefined MCharDefinition ^Startofastring. $Endofastring. .Anycharacter(except\nnewline) |Alternation. {...}Explicitquantifiernotation. [...]Explicitsetofcharacterstomatch. (...)Logicalgroupingofpartofanexpression. *0ormoreofpreviousexpression. +1ormoreofpreviousexpression. ?0or1ofpreviousexpression;alsoforcesminimalmatchingwhenanexpressionmightmatchseveralstringswithinasearchstring. \Precedingoneoftheabove,itmakesitaliteralinsteadofaspecialcharacter.Precedingaspecialmatchingcharacter,seebelow. MetacharacterExamples PatternSampleMatches ^abcabc,abcdefg,abc123,... abc$abc,endsinabc,123abc,... a.cabc,aac,acc,adc,aec,... bill|tedted,bill ab{2}cabbc a[bB]cabc,aBc (abc){2}abcabc ab*cac,abc,abbc,abbbc,... ab+cabc,abbc,abbbc,... ab?cac,abc a\scac CharacterEscapeshttp://tinyurl.com/5wm3wl EscapedCharDescription ordinarycharactersCharactersotherthan.$^{[(|)]}*+?\matchthemselves. \aMatchesabell(alarm)\u0007. \bMatchesabackspace\u0008ifina[];otherwisematchesawordboundary(between\wand\Wcharacters). \tMatchesatab\u0009. \rMatchesacarriagereturn\u000D. \vMatchesaverticaltab\u000B. \fMatchesaformfeed\u000C. \nMatchesanewline\u000A. \eMatchesanescape\u001B. \040MatchesanASCIIcharacterasoctal(uptothreedigits);numberswithnoleadingzeroarebackreferencesiftheyhaveonlyonedigitoriftheycorrespondtoacapturinggroupnumber.(Formoreinformation,seeBackreferences.)Forexample,thecharacter\040representsaspace. \x20MatchesanASCIIcharacterusinghexadecimalrepresentation(exactlytwodigits). \cCMatchesanASCIIcontrolcharacter;forexample\cCiscontrol-C. \u0020MatchesaUnicodecharacterusingahexadecimalrepresentation(exactlyfourdigits). \*Whenfollowedbyacharacterthatisnotrecognizedasanescapedcharacter,matchesthatcharacter.Forexample,\*isthesameas\x2A. CharacterClasseshttp://tinyurl.com/5ck4ll CharClassDescription .Matchesanycharacterexcept\n.IfmodifiedbytheSinglelineoption,aperiodcharactermatchesanycharacter.Formoreinformation,seeRegularExpressionOptions. [aeiou]Matchesanysinglecharacterincludedinthespecifiedsetofcharacters. [^aeiou]Matchesanysinglecharacternotinthespecifiedsetofcharacters. [0-9a-fA-F]Useofahyphen(–)allowsspecificationofcontiguouscharacterranges. \p{name}Matchesanycharacterinthenamedcharacterclassspecifiedby{name}.SupportednamesareUnicodegroupsandblockranges.Forexample,Ll,Nd,Z,IsGreek,IsBoxDrawing. \P{name}Matchestextnotincludedingroupsandblockrangesspecifiedin{name}. \wMatchesanywordcharacter.EquivalenttotheUnicodecharactercategories [\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}].IfECMAScript-compliantbehaviorisspecifiedwiththeECMAScriptoption,\wisequivalentto[a-zA-Z_0-9]. \WMatchesanynonwordcharacter.EquivalenttotheUnicodecategories[^\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}].IfECMAScript-compliantbehaviorisspecifiedwiththeECMAScriptoption,\Wisequivalentto[^a-zA-Z_0-9]. \sMatchesanywhite-spacecharacter.EquivalenttotheUnicodecharactercategories[\f\n\r\t\v\x85\p{Z}].IfECMAScript-compliantbehaviorisspecifiedwiththeECMAScriptoption,\sisequivalentto[\f\n\r\t\v]. \SMatchesanynon-white-spacecharacter.EquivalenttotheUnicodecharactercategories[^\f\n\r\t\v\x85\p{Z}].IfECMAScript-compliantbehaviorisspecifiedwiththeECMAScriptoption,\Sisequivalentto[^\f\n\r\t\v]. \dMatchesanydecimaldigit.Equivalentto\p{Nd}forUnicodeand[0-9]fornon-Unicode,ECMAScriptbehavior. \DMatchesanynondigit.Equivalentto\P{Nd}forUnicodeand[^0-9]fornon-Unicode,ECMAScriptbehavior.
延伸文章資訊
- 1Regex Cheat Sheet/Basics - - Rackspace
Regular Expressions (regex or regexp) are a very useful tool to identify specific patterns in any...
- 2Work with strings with stringr : : CHEAT SHEET - GitLab
Work with strings with stringr : : CHEAT SHEET. Detect Matches ... regexp matches example a? zero...
- 3RegEX Cheat Sheet & Quick Reference
This is a quick cheat sheet to getting started with regular expressions. ... re.compile, Compile ...
- 4regexp cheatsheet - Devhints
Basic cheatsheets for regular expression · One-page guide to regexp.
- 5RegExLib.com Regular Expression Cheat Sheet (.NET)
RegExLib.com Regular Expression Cheat Sheet (.NET). Metacharacters Defined. MChar, Definition. ^,...