Regex symbol list and regex examples - Codexpedia
文章推薦指數: 80 %
Regex symbol list and regex examples ; \b Backslash and b, matches a word boundary. For example, “\bwater” finds “watergun” but not “cleanwater” whereas “water\b ... Codexpedia Codexpedia(current) About Contact Search Regexsymbollistandregexexamples .Period,matchesasinglecharacterofanysinglecharacter,excepttheendofaline.Forexample,thebelowregexmatchesshirt,shortandanycharacterbetweenshandrt. sh.rt ^Carat,matchesatermifthetermappearsatthebeginningofaparagraphoraline.Forexample,thebelowregexmatchesaparagraphoralinestartswithApple. ^Apple ^Caratinsideabracket,forexample,thebelowregexmatchesanycharactersbuta,b,c,d,e. [^a-e] $Dollarsign,matchesatermifthetermappearsattheendofaparagraphoraline.Forexample,thebelowregexmatchesaparagraphoralineendswithbye. bye$ []Squarebrackets,matchesanysinglecharacterfromwithinthebracketedlist.Forexample,thebelowregexmatchesbad,bed,bcd,brd,andbod. b[aecro]d –Hyphen,usedforrepresentingarangeoflettersornumbers,oftenusedinsideasquarebracket.Forexample,thebelowregexmatcheskam,kbm,kcm,k2m,k3m,k4mandk5m. k[a-c2-5]m ()Parentheses,groupsoneormoreregularexpressions.Forexample,thebelowregexmatchescodexpedia.com,codexpedia.net,andcodexpedia.org. codexpedia\.(com|net|org) {n}Curlybracketswith1numberinsideit,matchesexactlyntimesoftheprecedingcharacter.Forexample,thebelowregularexpressionmatches4digitsstring,andonlyfourdigitsstringbecausethereis^atthebeginningand$attheendoftheregex. ^[\d]{4}$ {n,m}Curlybracketswith2numbersinsideit,matchesminimumandmaximumnumberoftimesoftheprecedingcharacter.Forexample,thebelowregularexpressionmatchesgoogle,gooogleandgoooogle. go{2,4}gle {n,},Curlybracketswithanumberandacomma,matchesminimumnumberoftimestheprecedingcharacter.Forexample,thebelowregexmatchesgoogle,gooogle,gooooogle,goooooogle,…. go{2,}gle |Pipe,matcheseithertheregularexpressionprecedingitortheregularexpressionfollowingit.Forexample,thebelowregexmatchesthedateformatofMM/DD/YYYY,MM.DD.YYYYandMM-DD-YYY.ItalsomatchesMM.DD-YYYY,etc. ^(0[1-9]|1[012])[-/.](0[1-9]|[12][0-9]|3[01])[-/.][0-9]{4}$ ?Questionmark,matches1or0characterinfrontofthequestionmark.Forexample,thebelowregularexpressionmatchesappleandapples. apples? *Asterisk,matches0ormorecharactersinfrontoftheasterisk.Forexample,thebelowregularexpressionmatchescl,col,cool,cool,…,coooooooooool,… co*l +Plus,matches1ormorecharactersinfronoftheplus.Forexample,thebelowregularexpressionmatchescol,cool,…,cooooooooooool,… co+l !Exclamation,donotmatchesthenextcharacterorregularexpression.Forexample,thebelowregularexpressionmatchesthethecharacherqifthecharachterafterqisnotadigit,itwillmatchestheqinthosestringsofabdqk,quit,qeig,butnotq2kd,sdkq8d. q(?![0-9]) \Backslash,turnsoffthespecialmeaningofthenextcharacter.Forexample,thebelowregextreatstheperiodasanormalcharacteranditmatchesa.bonly. a\.b \bBackslashandb,matchesawordboundary.Forexample,“\bwater”finds“watergun”butnot“cleanwater”whereas“water\b”finds“cleanwater”butnot“watergun”. \nBackslashandn,representsalinebreak. \tBackslashandt,representsatab. \wBackslashandw,itisequivalentto[a-zA-Z0-9_],matchesalphanumericcharacterorunderscore.Conversely,Capital\Wwillmatchnon-alphnumericcharacterandnotunderscore. \dBackslashandd,matchesdigits0to9,equivalentto[0-9]or[:digit] [:alpha:]or[A-Za-z]representsanalphabeticcharacter. [:digit:]or[0-9]or[\d]representsadigit. [:alnum:]or[A-Za-z0-9]representsanalphanumericcharacter. Thisregexmatchesemailaddresses \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b Thisregexmatcheswebsiteslinksendingwithsitesof.com,.org,.edu,.govand.us https?://(www\.)?[A-Za-z0-9]+\.(com|org|edu|gov|us)/?.* Thisregexmatchessocialsecuritynumbers. ^[0-9]{3}-[0-9]{2}-[0-9]{4}$ SearchwithinCodexpedia CustomSearch Searchtheentireweb CustomSearch RelatedPosts Javaregularexpressionexample Regexsymbollistandregexexamples More ←fileownershipsandfilepermisionsonLinuxandunixlikesystemsinstallingUbuntuonVirtualBox→
延伸文章資訊
- 1116 - Stack Overflow
The regular expression for this is really simple. Just use a character class. The hyphen is a spe...
- 2Regular Expressions (REGEX): Basic symbols - Scripting Blog
Regular Expressions (REGEX): Basic symbols · Take special properties away from special characters...
- 3Metacharacters - IBM
- 4Regex symbol list and regex examples - Codexpedia
Regex symbol list and regex examples ; \b Backslash and b, matches a word boundary. For example, ...
- 5What are ^.* and .*$ in regular expressions? - Stack Overflow