testinput6 89 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045
  1. # This set of tests check the DFA matching functionality of pcre2_dfa_match(),
  2. # excluding UTF and Unicode property support. All matches are done using DFA,
  3. # forced by setting a default subject modifier at the start.
  4. #forbid_utf
  5. #subject dfa
  6. #newline_default lf anycrlf any
  7. /abc/
  8. abc
  9. /ab*c/
  10. abc
  11. abbbbc
  12. ac
  13. /ab+c/
  14. abc
  15. abbbbbbc
  16. \= Expect no match
  17. ac
  18. ab
  19. /a*/no_auto_possess
  20. a
  21. aaaaaaaaaaaaaaaaa
  22. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=ovector=10
  23. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=dfa_shortest
  24. /(a|abcd|african)/
  25. a
  26. abcd
  27. african
  28. /^abc/
  29. abcdef
  30. \= Expect no match
  31. xyzabc
  32. xyz\nabc
  33. /^abc/m
  34. abcdef
  35. xyz\nabc
  36. \= Expect no match
  37. xyzabc
  38. /\Aabc/
  39. abcdef
  40. \= Expect no match
  41. xyzabc
  42. xyz\nabc
  43. /\Aabc/m
  44. abcdef
  45. \= Expect no match
  46. xyzabc
  47. xyz\nabc
  48. /\Gabc/
  49. abcdef
  50. xyzabc\=offset=3
  51. \= Expect no match
  52. xyzabc
  53. xyzabc\=offset=2
  54. /x\dy\Dz/
  55. x9yzz
  56. x0y+z
  57. \= Expect no match
  58. xyz
  59. xxy0z
  60. /x\sy\Sz/
  61. x yzz
  62. x y+z
  63. \= Expect no match
  64. xyz
  65. xxyyz
  66. /x\wy\Wz/
  67. xxy+z
  68. \= Expect no match
  69. xxy0z
  70. x+y+z
  71. /x.y/
  72. x+y
  73. x-y
  74. \= Expect no match
  75. x\ny
  76. /x.y/s
  77. x+y
  78. x-y
  79. x\ny
  80. /(a.b(?s)c.d|x.y)p.q/
  81. a+bc+dp+q
  82. a+bc\ndp+q
  83. x\nyp+q
  84. \= Expect no match
  85. a\nbc\ndp+q
  86. a+bc\ndp\nq
  87. x\nyp\nq
  88. /a\d\z/
  89. ba0
  90. \= Expect no match
  91. ba0\n
  92. ba0\ncd
  93. /a\d\z/m
  94. ba0
  95. \= Expect no match
  96. ba0\n
  97. ba0\ncd
  98. /a\d\Z/
  99. ba0
  100. ba0\n
  101. \= Expect no match
  102. ba0\ncd
  103. /a\d\Z/m
  104. ba0
  105. ba0\n
  106. \= Expect no match
  107. ba0\ncd
  108. /a\d$/
  109. ba0
  110. ba0\n
  111. \= Expect no match
  112. ba0\ncd
  113. /a\d$/m
  114. ba0
  115. ba0\n
  116. ba0\ncd
  117. /abc/i
  118. abc
  119. aBc
  120. ABC
  121. /[^a]/
  122. abcd
  123. /ab?\w/
  124. abz
  125. abbz
  126. azz
  127. /x{0,3}yz/
  128. ayzq
  129. axyzq
  130. axxyz
  131. axxxyzq
  132. axxxxyzq
  133. \= Expect no match
  134. ax
  135. axx
  136. /x{3}yz/
  137. axxxyzq
  138. axxxxyzq
  139. \= Expect no match
  140. ax
  141. axx
  142. ayzq
  143. axyzq
  144. axxyz
  145. /x{2,3}yz/
  146. axxyz
  147. axxxyzq
  148. axxxxyzq
  149. \= Expect no match
  150. ax
  151. axx
  152. ayzq
  153. axyzq
  154. /[^a]+/no_auto_possess
  155. bac
  156. bcdefax
  157. \= Expect no match
  158. aaaaa
  159. /[^a]*/no_auto_possess
  160. bac
  161. bcdefax
  162. aaaaa
  163. /[^a]{3,5}/no_auto_possess
  164. xyz
  165. awxyza
  166. abcdefa
  167. abcdefghijk
  168. \= Expect no match
  169. axya
  170. axa
  171. aaaaa
  172. /\d*/
  173. 1234b567
  174. xyz
  175. /\D*/
  176. a1234b567
  177. xyz
  178. /\d+/
  179. ab1234c56
  180. \= Expect no match
  181. xyz
  182. /\D+/
  183. ab123c56
  184. \= Expect no match
  185. 789
  186. /\d?A/
  187. 045ABC
  188. ABC
  189. \= Expect no match
  190. XYZ
  191. /\D?A/
  192. ABC
  193. BAC
  194. 9ABC
  195. /a+/
  196. aaaa
  197. /^.*xyz/
  198. xyz
  199. ggggggggxyz
  200. /^.+xyz/
  201. abcdxyz
  202. axyz
  203. \= Expect no match
  204. xyz
  205. /^.?xyz/
  206. xyz
  207. cxyz
  208. /^\d{2,3}X/
  209. 12X
  210. 123X
  211. \= Expect no match
  212. X
  213. 1X
  214. 1234X
  215. /^[abcd]\d/
  216. a45
  217. b93
  218. c99z
  219. d04
  220. \= Expect no match
  221. e45
  222. abcd
  223. abcd1234
  224. 1234
  225. /^[abcd]*\d/
  226. a45
  227. b93
  228. c99z
  229. d04
  230. abcd1234
  231. 1234
  232. \= Expect no match
  233. e45
  234. abcd
  235. /^[abcd]+\d/
  236. a45
  237. b93
  238. c99z
  239. d04
  240. abcd1234
  241. \= Expect no match
  242. 1234
  243. e45
  244. abcd
  245. /^a+X/
  246. aX
  247. aaX
  248. /^[abcd]?\d/
  249. a45
  250. b93
  251. c99z
  252. d04
  253. 1234
  254. \= Expect no match
  255. abcd1234
  256. e45
  257. /^[abcd]{2,3}\d/
  258. ab45
  259. bcd93
  260. \= Expect no match
  261. 1234
  262. a36
  263. abcd1234
  264. ee45
  265. /^(abc)*\d/
  266. abc45
  267. abcabcabc45
  268. 42xyz
  269. /^(abc)+\d/
  270. abc45
  271. abcabcabc45
  272. \= Expect no match
  273. 42xyz
  274. /^(abc)?\d/
  275. abc45
  276. 42xyz
  277. \= Expect no match
  278. abcabcabc45
  279. /^(abc){2,3}\d/
  280. abcabc45
  281. abcabcabc45
  282. \= Expect no match
  283. abcabcabcabc45
  284. abc45
  285. 42xyz
  286. /1(abc|xyz)2(?1)3/
  287. 1abc2abc3456
  288. 1abc2xyz3456
  289. /^(a*\w|ab)=(a*\w|ab)/
  290. ab=ab
  291. /^(a*\w|ab)=(?1)/
  292. ab=ab
  293. /^([^()]|\((?1)*\))*$/
  294. abc
  295. a(b)c
  296. a(b(c))d
  297. \= Expect no match)
  298. a(b(c)d
  299. /^>abc>([^()]|\((?1)*\))*<xyz<$/
  300. >abc>123<xyz<
  301. >abc>1(2)3<xyz<
  302. >abc>(1(2)3)<xyz<
  303. /^(?>a*)\d/
  304. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9876
  305. \= Expect no match
  306. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  307. /< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/x
  308. <>
  309. <abcd>
  310. <abc <123> hij>
  311. <abc <def> hij>
  312. <abc<>def>
  313. <abc<>
  314. \= Expect no match
  315. <abc
  316. /^(?(?=abc)\w{3}:|\d\d)$/
  317. abc:
  318. 12
  319. \= Expect no match
  320. 123
  321. xyz
  322. /^(?(?!abc)\d\d|\w{3}:)$/
  323. abc:
  324. 12
  325. \= Expect no match
  326. 123
  327. xyz
  328. /^(?=abc)\w{5}:$/
  329. abcde:
  330. \= Expect no match
  331. abc..
  332. 123
  333. vwxyz
  334. /^(?!abc)\d\d$/
  335. 12
  336. \= Expect no match
  337. abcde:
  338. abc..
  339. 123
  340. vwxyz
  341. /(?<=abc|xy)123/
  342. abc12345
  343. wxy123z
  344. \= Expect no match
  345. 123abc
  346. /(?<!abc|xy)123/
  347. 123abc
  348. mno123456
  349. \= Expect no match
  350. abc12345
  351. wxy123z
  352. /abc(?C1)xyz/
  353. abcxyz
  354. 123abcxyz999
  355. /(ab|cd){3,4}/auto_callout
  356. ababab
  357. abcdabcd
  358. abcdcdcdcdcd
  359. /^abc/
  360. abcdef
  361. \= Expect no match
  362. abcdef\=notbol
  363. /^(a*|xyz)/
  364. bcd
  365. aaabcd
  366. xyz
  367. xyz\=notempty
  368. \= Expect no match
  369. bcd\=notempty
  370. /xyz$/
  371. xyz
  372. xyz\n
  373. \= Expect no match
  374. xyz\=noteol
  375. xyz\n\=noteol
  376. /xyz$/m
  377. xyz
  378. xyz\n
  379. abcxyz\npqr
  380. abcxyz\npqr\=noteol
  381. xyz\n\=noteol
  382. \= Expect no match
  383. xyz\=noteol
  384. /\Gabc/
  385. abcdef
  386. defabcxyz\=offset=3
  387. \= Expect no match
  388. defabcxyz
  389. /^abcdef/
  390. ab\=ps
  391. abcde\=ps
  392. abcdef\=ps
  393. \= Expect no match
  394. abx\=ps
  395. /^a{2,4}\d+z/
  396. a\=ps
  397. aa\=ps
  398. aa2\=ps
  399. aaa\=ps
  400. aaa23\=ps
  401. aaaa12345\=ps
  402. aa0z\=ps
  403. aaaa4444444444444z\=ps
  404. \= Expect no match
  405. az\=ps
  406. aaaaa\=ps
  407. a56\=ps
  408. /^abcdef/
  409. abc\=ps
  410. def\=dfa_restart
  411. /(?<=foo)bar/
  412. foob\=ps,offset=2,allusedtext
  413. foobar...\=ps,dfa_restart,offset=4
  414. foobar\=offset=2
  415. \= Expect no match
  416. xyzfo\=ps
  417. obar\=dfa_restart
  418. /(ab*(cd|ef))+X/
  419. lkjhlkjhlkjhlkjhabbbbbbcdaefabbbbbbbefa\=ps,notbol,noteol
  420. cdabbbbbbbb\=ps,notbol,dfa_restart,noteol
  421. efabbbbbbbbbbbbbbbb\=ps,notbol,dfa_restart,noteol
  422. bbbbbbbbbbbbcdXyasdfadf\=ps,notbol,dfa_restart,noteol
  423. \= Expect no match
  424. adfadadaklhlkalkajhlkjahdfasdfasdfladsfjkj\=ps,noteol
  425. /the quick brown fox/
  426. the quick brown fox
  427. What do you know about the quick brown fox?
  428. \= Expect no match
  429. The quick brown FOX
  430. What do you know about THE QUICK BROWN FOX?
  431. /The quick brown fox/i
  432. the quick brown fox
  433. The quick brown FOX
  434. What do you know about the quick brown fox?
  435. What do you know about THE QUICK BROWN FOX?
  436. /abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
  437. abcd\t\n\r\f\a\e9;\$\\?caxyz
  438. /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
  439. abxyzpqrrrabbxyyyypqAzz
  440. abxyzpqrrrabbxyyyypqAzz
  441. aabxyzpqrrrabbxyyyypqAzz
  442. aaabxyzpqrrrabbxyyyypqAzz
  443. aaaabxyzpqrrrabbxyyyypqAzz
  444. abcxyzpqrrrabbxyyyypqAzz
  445. aabcxyzpqrrrabbxyyyypqAzz
  446. aaabcxyzpqrrrabbxyyyypAzz
  447. aaabcxyzpqrrrabbxyyyypqAzz
  448. aaabcxyzpqrrrabbxyyyypqqAzz
  449. aaabcxyzpqrrrabbxyyyypqqqAzz
  450. aaabcxyzpqrrrabbxyyyypqqqqAzz
  451. aaabcxyzpqrrrabbxyyyypqqqqqAzz
  452. aaabcxyzpqrrrabbxyyyypqqqqqqAzz
  453. aaaabcxyzpqrrrabbxyyyypqAzz
  454. abxyzzpqrrrabbxyyyypqAzz
  455. aabxyzzzpqrrrabbxyyyypqAzz
  456. aaabxyzzzzpqrrrabbxyyyypqAzz
  457. aaaabxyzzzzpqrrrabbxyyyypqAzz
  458. abcxyzzpqrrrabbxyyyypqAzz
  459. aabcxyzzzpqrrrabbxyyyypqAzz
  460. aaabcxyzzzzpqrrrabbxyyyypqAzz
  461. aaaabcxyzzzzpqrrrabbxyyyypqAzz
  462. aaaabcxyzzzzpqrrrabbbxyyyypqAzz
  463. aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
  464. aaabcxyzpqrrrabbxyyyypABzz
  465. aaabcxyzpqrrrabbxyyyypABBzz
  466. >>>aaabxyzpqrrrabbxyyyypqAzz
  467. >aaaabxyzpqrrrabbxyyyypqAzz
  468. >>>>abcxyzpqrrrabbxyyyypqAzz
  469. \= Expect no match
  470. abxyzpqrrabbxyyyypqAzz
  471. abxyzpqrrrrabbxyyyypqAzz
  472. abxyzpqrrrabxyyyypqAzz
  473. aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
  474. aaaabcxyzzzzpqrrrabbbxyyypqAzz
  475. aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
  476. /^(abc){1,2}zz/
  477. abczz
  478. abcabczz
  479. \= Expect no match
  480. zz
  481. abcabcabczz
  482. >>abczz
  483. /^(b+?|a){1,2}?c/
  484. bc
  485. bbc
  486. bbbc
  487. bac
  488. bbac
  489. aac
  490. abbbbbbbbbbbc
  491. bbbbbbbbbbbac
  492. \= Expect no match
  493. aaac
  494. abbbbbbbbbbbac
  495. /^(b+|a){1,2}c/
  496. bc
  497. bbc
  498. bbbc
  499. bac
  500. bbac
  501. aac
  502. abbbbbbbbbbbc
  503. bbbbbbbbbbbac
  504. \= Expect no match
  505. aaac
  506. abbbbbbbbbbbac
  507. /^(b+|a){1,2}?bc/
  508. bbc
  509. /^(b*|ba){1,2}?bc/
  510. babc
  511. bbabc
  512. bababc
  513. \= Expect no match
  514. bababbc
  515. babababc
  516. /^(ba|b*){1,2}?bc/
  517. babc
  518. bbabc
  519. bababc
  520. \= Expect no match
  521. bababbc
  522. babababc
  523. /^\ca\cA\c[\c{\c:/
  524. \x01\x01\e;z
  525. /^[ab\]cde]/
  526. athing
  527. bthing
  528. ]thing
  529. cthing
  530. dthing
  531. ething
  532. \= Expect no match
  533. fthing
  534. [thing
  535. \\thing
  536. /^[]cde]/
  537. ]thing
  538. cthing
  539. dthing
  540. ething
  541. \= Expect no match
  542. athing
  543. fthing
  544. /^[^ab\]cde]/
  545. fthing
  546. [thing
  547. \\thing
  548. \= Expect no match
  549. athing
  550. bthing
  551. ]thing
  552. cthing
  553. dthing
  554. ething
  555. /^[^]cde]/
  556. athing
  557. fthing
  558. \= Expect no match
  559. ]thing
  560. cthing
  561. dthing
  562. ething
  563. /^\�/
  564. /^ÿ/
  565. ÿ
  566. /^[0-9]+$/
  567. 0
  568. 1
  569. 2
  570. 3
  571. 4
  572. 5
  573. 6
  574. 7
  575. 8
  576. 9
  577. 10
  578. 100
  579. \= Expect no match
  580. abc
  581. /^.*nter/
  582. enter
  583. inter
  584. uponter
  585. /^xxx[0-9]+$/
  586. xxx0
  587. xxx1234
  588. \= Expect no match
  589. xxx
  590. /^.+[0-9][0-9][0-9]$/
  591. x123
  592. xx123
  593. 123456
  594. x1234
  595. \= Expect no match
  596. 123
  597. /^.+?[0-9][0-9][0-9]$/
  598. x123
  599. xx123
  600. 123456
  601. x1234
  602. \= Expect no match
  603. 123
  604. /^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
  605. abc!pqr=apquxz.ixr.zzz.ac.uk
  606. \= Expect no match
  607. !pqr=apquxz.ixr.zzz.ac.uk
  608. abc!=apquxz.ixr.zzz.ac.uk
  609. abc!pqr=apquxz:ixr.zzz.ac.uk
  610. abc!pqr=apquxz.ixr.zzz.ac.ukk
  611. /:/
  612. Well, we need a colon: somewhere
  613. \= Expect no match
  614. No match without a colon
  615. /([\da-f:]+)$/i
  616. 0abc
  617. abc
  618. fed
  619. E
  620. ::
  621. 5f03:12C0::932e
  622. fed def
  623. Any old stuff
  624. \= Expect no match
  625. 0zzz
  626. gzzz
  627. fed\x20
  628. Any old rubbish
  629. /^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
  630. .1.2.3
  631. A.12.123.0
  632. \= Expect no match
  633. .1.2.3333
  634. 1.2.3
  635. 1234.2.3
  636. /^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
  637. 1 IN SOA non-sp1 non-sp2(
  638. 1 IN SOA non-sp1 non-sp2 (
  639. \= Expect no match
  640. 1IN SOA non-sp1 non-sp2(
  641. /^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
  642. a.
  643. Z.
  644. 2.
  645. ab-c.pq-r.
  646. sxk.zzz.ac.uk.
  647. x-.y-.
  648. \= Expect no match
  649. -abc.peq.
  650. /^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
  651. *.a
  652. *.b0-a
  653. *.c3-b.c
  654. *.c-a.b-c
  655. \= Expect no match
  656. *.0
  657. *.a-
  658. *.a-b.c-
  659. *.c-a.0-c
  660. /^(?=ab(de))(abd)(e)/
  661. abde
  662. /^(?!(ab)de|x)(abd)(f)/
  663. abdf
  664. /^(?=(ab(cd)))(ab)/
  665. abcd
  666. /^[\da-f](\.[\da-f])*$/i
  667. a.b.c.d
  668. A.B.C.D
  669. a.b.c.1.2.3.C
  670. /^\".*\"\s*(;.*)?$/
  671. \"1234\"
  672. \"abcd\" ;
  673. \"\" ; rhubarb
  674. \= Expect no match
  675. \"1234\" : things
  676. /^$/
  677. \
  678. / ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x
  679. ab c
  680. \= Expect no match
  681. abc
  682. ab cde
  683. /(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/
  684. ab c
  685. \= Expect no match
  686. abc
  687. ab cde
  688. /^ a\ b[c ]d $/x
  689. a bcd
  690. a b d
  691. \= Expect no match
  692. abcd
  693. ab d
  694. /^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
  695. abcdefhijklm
  696. /^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
  697. abcdefhijklm
  698. /^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
  699. a+ Z0+\x08\n\x1d\x12
  700. /^[.^$|()*+?{,}]+/
  701. .^\$(*+)|{?,?}
  702. /^a*\w/
  703. z
  704. az
  705. aaaz
  706. a
  707. aa
  708. aaaa
  709. a+
  710. aa+
  711. /^a*?\w/
  712. z
  713. az
  714. aaaz
  715. a
  716. aa
  717. aaaa
  718. a+
  719. aa+
  720. /^a+\w/
  721. az
  722. aaaz
  723. aa
  724. aaaa
  725. aa+
  726. /^a+?\w/
  727. az
  728. aaaz
  729. aa
  730. aaaa
  731. aa+
  732. /^\d{8}\w{2,}/
  733. 1234567890
  734. 12345678ab
  735. 12345678__
  736. \= Expect no match
  737. 1234567
  738. /^[aeiou\d]{4,5}$/
  739. uoie
  740. 1234
  741. 12345
  742. aaaaa
  743. \= Expect no match
  744. 123456
  745. /^[aeiou\d]{4,5}?/
  746. uoie
  747. 1234
  748. 12345
  749. aaaaa
  750. 123456
  751. /^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/
  752. From abcd Mon Sep 01 12:33:02 1997
  753. /^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
  754. From abcd Mon Sep 01 12:33:02 1997
  755. From abcd Mon Sep 1 12:33:02 1997
  756. \= Expect no match
  757. From abcd Sep 01 12:33:02 1997
  758. /^12.34/s
  759. 12\n34
  760. 12\r34
  761. /\w+(?=\t)/
  762. the quick brown\t fox
  763. /foo(?!bar)(.*)/
  764. foobar is foolish see?
  765. /(?:(?!foo)...|^.{0,2})bar(.*)/
  766. foobar crowbar etc
  767. barrel
  768. 2barrel
  769. A barrel
  770. /^(\D*)(?=\d)(?!123)/
  771. abc456
  772. \= Expect no match
  773. abc123
  774. /^1234(?# test newlines
  775. inside)/
  776. 1234
  777. /^1234 #comment in extended re
  778. /x
  779. 1234
  780. /#rhubarb
  781. abcd/x
  782. abcd
  783. /^abcd#rhubarb/x
  784. abcd
  785. /(?!^)abc/
  786. the abc
  787. \= Expect no match
  788. abc
  789. /(?=^)abc/
  790. abc
  791. \= Expect no match
  792. the abc
  793. /^[ab]{1,3}(ab*|b)/no_auto_possess
  794. aabbbbb
  795. /^[ab]{1,3}?(ab*|b)/no_auto_possess
  796. aabbbbb
  797. /^[ab]{1,3}?(ab*?|b)/no_auto_possess
  798. aabbbbb
  799. /^[ab]{1,3}(ab*?|b)/no_auto_possess
  800. aabbbbb
  801. / (?: [\040\t] | \(
  802. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  803. \) )* # optional leading comment
  804. (?: (?:
  805. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  806. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  807. |
  808. " (?: # opening quote...
  809. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  810. | # or
  811. \\ [^\x80-\xff] # Escaped something (something != CR)
  812. )* " # closing quote
  813. ) # initial word
  814. (?: (?: [\040\t] | \(
  815. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  816. \) )* \. (?: [\040\t] | \(
  817. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  818. \) )* (?:
  819. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  820. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  821. |
  822. " (?: # opening quote...
  823. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  824. | # or
  825. \\ [^\x80-\xff] # Escaped something (something != CR)
  826. )* " # closing quote
  827. ) )* # further okay, if led by a period
  828. (?: [\040\t] | \(
  829. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  830. \) )* @ (?: [\040\t] | \(
  831. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  832. \) )* (?:
  833. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  834. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  835. | \[ # [
  836. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  837. \] # ]
  838. ) # initial subdomain
  839. (?: #
  840. (?: [\040\t] | \(
  841. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  842. \) )* \. # if led by a period...
  843. (?: [\040\t] | \(
  844. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  845. \) )* (?:
  846. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  847. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  848. | \[ # [
  849. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  850. \] # ]
  851. ) # ...further okay
  852. )*
  853. # address
  854. | # or
  855. (?:
  856. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  857. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  858. |
  859. " (?: # opening quote...
  860. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  861. | # or
  862. \\ [^\x80-\xff] # Escaped something (something != CR)
  863. )* " # closing quote
  864. ) # one word, optionally followed by....
  865. (?:
  866. [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or...
  867. \(
  868. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  869. \) | # comments, or...
  870. " (?: # opening quote...
  871. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  872. | # or
  873. \\ [^\x80-\xff] # Escaped something (something != CR)
  874. )* " # closing quote
  875. # quoted strings
  876. )*
  877. < (?: [\040\t] | \(
  878. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  879. \) )* # leading <
  880. (?: @ (?: [\040\t] | \(
  881. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  882. \) )* (?:
  883. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  884. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  885. | \[ # [
  886. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  887. \] # ]
  888. ) # initial subdomain
  889. (?: #
  890. (?: [\040\t] | \(
  891. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  892. \) )* \. # if led by a period...
  893. (?: [\040\t] | \(
  894. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  895. \) )* (?:
  896. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  897. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  898. | \[ # [
  899. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  900. \] # ]
  901. ) # ...further okay
  902. )*
  903. (?: (?: [\040\t] | \(
  904. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  905. \) )* , (?: [\040\t] | \(
  906. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  907. \) )* @ (?: [\040\t] | \(
  908. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  909. \) )* (?:
  910. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  911. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  912. | \[ # [
  913. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  914. \] # ]
  915. ) # initial subdomain
  916. (?: #
  917. (?: [\040\t] | \(
  918. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  919. \) )* \. # if led by a period...
  920. (?: [\040\t] | \(
  921. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  922. \) )* (?:
  923. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  924. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  925. | \[ # [
  926. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  927. \] # ]
  928. ) # ...further okay
  929. )*
  930. )* # further okay, if led by comma
  931. : # closing colon
  932. (?: [\040\t] | \(
  933. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  934. \) )* )? # optional route
  935. (?:
  936. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  937. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  938. |
  939. " (?: # opening quote...
  940. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  941. | # or
  942. \\ [^\x80-\xff] # Escaped something (something != CR)
  943. )* " # closing quote
  944. ) # initial word
  945. (?: (?: [\040\t] | \(
  946. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  947. \) )* \. (?: [\040\t] | \(
  948. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  949. \) )* (?:
  950. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  951. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  952. |
  953. " (?: # opening quote...
  954. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  955. | # or
  956. \\ [^\x80-\xff] # Escaped something (something != CR)
  957. )* " # closing quote
  958. ) )* # further okay, if led by a period
  959. (?: [\040\t] | \(
  960. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  961. \) )* @ (?: [\040\t] | \(
  962. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  963. \) )* (?:
  964. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  965. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  966. | \[ # [
  967. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  968. \] # ]
  969. ) # initial subdomain
  970. (?: #
  971. (?: [\040\t] | \(
  972. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  973. \) )* \. # if led by a period...
  974. (?: [\040\t] | \(
  975. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  976. \) )* (?:
  977. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  978. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  979. | \[ # [
  980. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  981. \] # ]
  982. ) # ...further okay
  983. )*
  984. # address spec
  985. (?: [\040\t] | \(
  986. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  987. \) )* > # trailing >
  988. # name and address
  989. ) (?: [\040\t] | \(
  990. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  991. \) )* # optional trailing comment
  992. /x
  993. Alan Other <user\@dom.ain>
  994. <user\@dom.ain>
  995. user\@dom.ain
  996. \"A. Other\" <user.1234\@dom.ain> (a comment)
  997. A. Other <user.1234\@dom.ain> (a comment)
  998. \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
  999. A missing angle <user\@some.where
  1000. \= Expect no match
  1001. The quick brown fox
  1002. /[\040\t]* # Nab whitespace.
  1003. (?:
  1004. \( # (
  1005. [^\\\x80-\xff\n\015()] * # normal*
  1006. (?: # (
  1007. (?: \\ [^\x80-\xff] |
  1008. \( # (
  1009. [^\\\x80-\xff\n\015()] * # normal*
  1010. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1011. \) # )
  1012. ) # special
  1013. [^\\\x80-\xff\n\015()] * # normal*
  1014. )* # )*
  1015. \) # )
  1016. [\040\t]* )* # If comment found, allow more spaces.
  1017. # optional leading comment
  1018. (?:
  1019. (?:
  1020. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1021. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1022. # Atom
  1023. | # or
  1024. " # "
  1025. [^\\\x80-\xff\n\015"] * # normal
  1026. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1027. " # "
  1028. # Quoted string
  1029. )
  1030. [\040\t]* # Nab whitespace.
  1031. (?:
  1032. \( # (
  1033. [^\\\x80-\xff\n\015()] * # normal*
  1034. (?: # (
  1035. (?: \\ [^\x80-\xff] |
  1036. \( # (
  1037. [^\\\x80-\xff\n\015()] * # normal*
  1038. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1039. \) # )
  1040. ) # special
  1041. [^\\\x80-\xff\n\015()] * # normal*
  1042. )* # )*
  1043. \) # )
  1044. [\040\t]* )* # If comment found, allow more spaces.
  1045. (?:
  1046. \.
  1047. [\040\t]* # Nab whitespace.
  1048. (?:
  1049. \( # (
  1050. [^\\\x80-\xff\n\015()] * # normal*
  1051. (?: # (
  1052. (?: \\ [^\x80-\xff] |
  1053. \( # (
  1054. [^\\\x80-\xff\n\015()] * # normal*
  1055. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1056. \) # )
  1057. ) # special
  1058. [^\\\x80-\xff\n\015()] * # normal*
  1059. )* # )*
  1060. \) # )
  1061. [\040\t]* )* # If comment found, allow more spaces.
  1062. (?:
  1063. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1064. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1065. # Atom
  1066. | # or
  1067. " # "
  1068. [^\\\x80-\xff\n\015"] * # normal
  1069. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1070. " # "
  1071. # Quoted string
  1072. )
  1073. [\040\t]* # Nab whitespace.
  1074. (?:
  1075. \( # (
  1076. [^\\\x80-\xff\n\015()] * # normal*
  1077. (?: # (
  1078. (?: \\ [^\x80-\xff] |
  1079. \( # (
  1080. [^\\\x80-\xff\n\015()] * # normal*
  1081. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1082. \) # )
  1083. ) # special
  1084. [^\\\x80-\xff\n\015()] * # normal*
  1085. )* # )*
  1086. \) # )
  1087. [\040\t]* )* # If comment found, allow more spaces.
  1088. # additional words
  1089. )*
  1090. @
  1091. [\040\t]* # Nab whitespace.
  1092. (?:
  1093. \( # (
  1094. [^\\\x80-\xff\n\015()] * # normal*
  1095. (?: # (
  1096. (?: \\ [^\x80-\xff] |
  1097. \( # (
  1098. [^\\\x80-\xff\n\015()] * # normal*
  1099. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1100. \) # )
  1101. ) # special
  1102. [^\\\x80-\xff\n\015()] * # normal*
  1103. )* # )*
  1104. \) # )
  1105. [\040\t]* )* # If comment found, allow more spaces.
  1106. (?:
  1107. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1108. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1109. |
  1110. \[ # [
  1111. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1112. \] # ]
  1113. )
  1114. [\040\t]* # Nab whitespace.
  1115. (?:
  1116. \( # (
  1117. [^\\\x80-\xff\n\015()] * # normal*
  1118. (?: # (
  1119. (?: \\ [^\x80-\xff] |
  1120. \( # (
  1121. [^\\\x80-\xff\n\015()] * # normal*
  1122. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1123. \) # )
  1124. ) # special
  1125. [^\\\x80-\xff\n\015()] * # normal*
  1126. )* # )*
  1127. \) # )
  1128. [\040\t]* )* # If comment found, allow more spaces.
  1129. # optional trailing comments
  1130. (?:
  1131. \.
  1132. [\040\t]* # Nab whitespace.
  1133. (?:
  1134. \( # (
  1135. [^\\\x80-\xff\n\015()] * # normal*
  1136. (?: # (
  1137. (?: \\ [^\x80-\xff] |
  1138. \( # (
  1139. [^\\\x80-\xff\n\015()] * # normal*
  1140. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1141. \) # )
  1142. ) # special
  1143. [^\\\x80-\xff\n\015()] * # normal*
  1144. )* # )*
  1145. \) # )
  1146. [\040\t]* )* # If comment found, allow more spaces.
  1147. (?:
  1148. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1149. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1150. |
  1151. \[ # [
  1152. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1153. \] # ]
  1154. )
  1155. [\040\t]* # Nab whitespace.
  1156. (?:
  1157. \( # (
  1158. [^\\\x80-\xff\n\015()] * # normal*
  1159. (?: # (
  1160. (?: \\ [^\x80-\xff] |
  1161. \( # (
  1162. [^\\\x80-\xff\n\015()] * # normal*
  1163. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1164. \) # )
  1165. ) # special
  1166. [^\\\x80-\xff\n\015()] * # normal*
  1167. )* # )*
  1168. \) # )
  1169. [\040\t]* )* # If comment found, allow more spaces.
  1170. # optional trailing comments
  1171. )*
  1172. # address
  1173. | # or
  1174. (?:
  1175. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1176. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1177. # Atom
  1178. | # or
  1179. " # "
  1180. [^\\\x80-\xff\n\015"] * # normal
  1181. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1182. " # "
  1183. # Quoted string
  1184. )
  1185. # leading word
  1186. [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces
  1187. (?:
  1188. (?:
  1189. \( # (
  1190. [^\\\x80-\xff\n\015()] * # normal*
  1191. (?: # (
  1192. (?: \\ [^\x80-\xff] |
  1193. \( # (
  1194. [^\\\x80-\xff\n\015()] * # normal*
  1195. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1196. \) # )
  1197. ) # special
  1198. [^\\\x80-\xff\n\015()] * # normal*
  1199. )* # )*
  1200. \) # )
  1201. |
  1202. " # "
  1203. [^\\\x80-\xff\n\015"] * # normal
  1204. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1205. " # "
  1206. ) # "special" comment or quoted string
  1207. [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal"
  1208. )*
  1209. <
  1210. [\040\t]* # Nab whitespace.
  1211. (?:
  1212. \( # (
  1213. [^\\\x80-\xff\n\015()] * # normal*
  1214. (?: # (
  1215. (?: \\ [^\x80-\xff] |
  1216. \( # (
  1217. [^\\\x80-\xff\n\015()] * # normal*
  1218. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1219. \) # )
  1220. ) # special
  1221. [^\\\x80-\xff\n\015()] * # normal*
  1222. )* # )*
  1223. \) # )
  1224. [\040\t]* )* # If comment found, allow more spaces.
  1225. # <
  1226. (?:
  1227. @
  1228. [\040\t]* # Nab whitespace.
  1229. (?:
  1230. \( # (
  1231. [^\\\x80-\xff\n\015()] * # normal*
  1232. (?: # (
  1233. (?: \\ [^\x80-\xff] |
  1234. \( # (
  1235. [^\\\x80-\xff\n\015()] * # normal*
  1236. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1237. \) # )
  1238. ) # special
  1239. [^\\\x80-\xff\n\015()] * # normal*
  1240. )* # )*
  1241. \) # )
  1242. [\040\t]* )* # If comment found, allow more spaces.
  1243. (?:
  1244. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1245. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1246. |
  1247. \[ # [
  1248. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1249. \] # ]
  1250. )
  1251. [\040\t]* # Nab whitespace.
  1252. (?:
  1253. \( # (
  1254. [^\\\x80-\xff\n\015()] * # normal*
  1255. (?: # (
  1256. (?: \\ [^\x80-\xff] |
  1257. \( # (
  1258. [^\\\x80-\xff\n\015()] * # normal*
  1259. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1260. \) # )
  1261. ) # special
  1262. [^\\\x80-\xff\n\015()] * # normal*
  1263. )* # )*
  1264. \) # )
  1265. [\040\t]* )* # If comment found, allow more spaces.
  1266. # optional trailing comments
  1267. (?:
  1268. \.
  1269. [\040\t]* # Nab whitespace.
  1270. (?:
  1271. \( # (
  1272. [^\\\x80-\xff\n\015()] * # normal*
  1273. (?: # (
  1274. (?: \\ [^\x80-\xff] |
  1275. \( # (
  1276. [^\\\x80-\xff\n\015()] * # normal*
  1277. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1278. \) # )
  1279. ) # special
  1280. [^\\\x80-\xff\n\015()] * # normal*
  1281. )* # )*
  1282. \) # )
  1283. [\040\t]* )* # If comment found, allow more spaces.
  1284. (?:
  1285. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1286. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1287. |
  1288. \[ # [
  1289. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1290. \] # ]
  1291. )
  1292. [\040\t]* # Nab whitespace.
  1293. (?:
  1294. \( # (
  1295. [^\\\x80-\xff\n\015()] * # normal*
  1296. (?: # (
  1297. (?: \\ [^\x80-\xff] |
  1298. \( # (
  1299. [^\\\x80-\xff\n\015()] * # normal*
  1300. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1301. \) # )
  1302. ) # special
  1303. [^\\\x80-\xff\n\015()] * # normal*
  1304. )* # )*
  1305. \) # )
  1306. [\040\t]* )* # If comment found, allow more spaces.
  1307. # optional trailing comments
  1308. )*
  1309. (?: ,
  1310. [\040\t]* # Nab whitespace.
  1311. (?:
  1312. \( # (
  1313. [^\\\x80-\xff\n\015()] * # normal*
  1314. (?: # (
  1315. (?: \\ [^\x80-\xff] |
  1316. \( # (
  1317. [^\\\x80-\xff\n\015()] * # normal*
  1318. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1319. \) # )
  1320. ) # special
  1321. [^\\\x80-\xff\n\015()] * # normal*
  1322. )* # )*
  1323. \) # )
  1324. [\040\t]* )* # If comment found, allow more spaces.
  1325. @
  1326. [\040\t]* # Nab whitespace.
  1327. (?:
  1328. \( # (
  1329. [^\\\x80-\xff\n\015()] * # normal*
  1330. (?: # (
  1331. (?: \\ [^\x80-\xff] |
  1332. \( # (
  1333. [^\\\x80-\xff\n\015()] * # normal*
  1334. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1335. \) # )
  1336. ) # special
  1337. [^\\\x80-\xff\n\015()] * # normal*
  1338. )* # )*
  1339. \) # )
  1340. [\040\t]* )* # If comment found, allow more spaces.
  1341. (?:
  1342. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1343. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1344. |
  1345. \[ # [
  1346. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1347. \] # ]
  1348. )
  1349. [\040\t]* # Nab whitespace.
  1350. (?:
  1351. \( # (
  1352. [^\\\x80-\xff\n\015()] * # normal*
  1353. (?: # (
  1354. (?: \\ [^\x80-\xff] |
  1355. \( # (
  1356. [^\\\x80-\xff\n\015()] * # normal*
  1357. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1358. \) # )
  1359. ) # special
  1360. [^\\\x80-\xff\n\015()] * # normal*
  1361. )* # )*
  1362. \) # )
  1363. [\040\t]* )* # If comment found, allow more spaces.
  1364. # optional trailing comments
  1365. (?:
  1366. \.
  1367. [\040\t]* # Nab whitespace.
  1368. (?:
  1369. \( # (
  1370. [^\\\x80-\xff\n\015()] * # normal*
  1371. (?: # (
  1372. (?: \\ [^\x80-\xff] |
  1373. \( # (
  1374. [^\\\x80-\xff\n\015()] * # normal*
  1375. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1376. \) # )
  1377. ) # special
  1378. [^\\\x80-\xff\n\015()] * # normal*
  1379. )* # )*
  1380. \) # )
  1381. [\040\t]* )* # If comment found, allow more spaces.
  1382. (?:
  1383. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1384. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1385. |
  1386. \[ # [
  1387. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1388. \] # ]
  1389. )
  1390. [\040\t]* # Nab whitespace.
  1391. (?:
  1392. \( # (
  1393. [^\\\x80-\xff\n\015()] * # normal*
  1394. (?: # (
  1395. (?: \\ [^\x80-\xff] |
  1396. \( # (
  1397. [^\\\x80-\xff\n\015()] * # normal*
  1398. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1399. \) # )
  1400. ) # special
  1401. [^\\\x80-\xff\n\015()] * # normal*
  1402. )* # )*
  1403. \) # )
  1404. [\040\t]* )* # If comment found, allow more spaces.
  1405. # optional trailing comments
  1406. )*
  1407. )* # additional domains
  1408. :
  1409. [\040\t]* # Nab whitespace.
  1410. (?:
  1411. \( # (
  1412. [^\\\x80-\xff\n\015()] * # normal*
  1413. (?: # (
  1414. (?: \\ [^\x80-\xff] |
  1415. \( # (
  1416. [^\\\x80-\xff\n\015()] * # normal*
  1417. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1418. \) # )
  1419. ) # special
  1420. [^\\\x80-\xff\n\015()] * # normal*
  1421. )* # )*
  1422. \) # )
  1423. [\040\t]* )* # If comment found, allow more spaces.
  1424. # optional trailing comments
  1425. )? # optional route
  1426. (?:
  1427. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1428. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1429. # Atom
  1430. | # or
  1431. " # "
  1432. [^\\\x80-\xff\n\015"] * # normal
  1433. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1434. " # "
  1435. # Quoted string
  1436. )
  1437. [\040\t]* # Nab whitespace.
  1438. (?:
  1439. \( # (
  1440. [^\\\x80-\xff\n\015()] * # normal*
  1441. (?: # (
  1442. (?: \\ [^\x80-\xff] |
  1443. \( # (
  1444. [^\\\x80-\xff\n\015()] * # normal*
  1445. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1446. \) # )
  1447. ) # special
  1448. [^\\\x80-\xff\n\015()] * # normal*
  1449. )* # )*
  1450. \) # )
  1451. [\040\t]* )* # If comment found, allow more spaces.
  1452. (?:
  1453. \.
  1454. [\040\t]* # Nab whitespace.
  1455. (?:
  1456. \( # (
  1457. [^\\\x80-\xff\n\015()] * # normal*
  1458. (?: # (
  1459. (?: \\ [^\x80-\xff] |
  1460. \( # (
  1461. [^\\\x80-\xff\n\015()] * # normal*
  1462. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1463. \) # )
  1464. ) # special
  1465. [^\\\x80-\xff\n\015()] * # normal*
  1466. )* # )*
  1467. \) # )
  1468. [\040\t]* )* # If comment found, allow more spaces.
  1469. (?:
  1470. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1471. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1472. # Atom
  1473. | # or
  1474. " # "
  1475. [^\\\x80-\xff\n\015"] * # normal
  1476. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1477. " # "
  1478. # Quoted string
  1479. )
  1480. [\040\t]* # Nab whitespace.
  1481. (?:
  1482. \( # (
  1483. [^\\\x80-\xff\n\015()] * # normal*
  1484. (?: # (
  1485. (?: \\ [^\x80-\xff] |
  1486. \( # (
  1487. [^\\\x80-\xff\n\015()] * # normal*
  1488. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1489. \) # )
  1490. ) # special
  1491. [^\\\x80-\xff\n\015()] * # normal*
  1492. )* # )*
  1493. \) # )
  1494. [\040\t]* )* # If comment found, allow more spaces.
  1495. # additional words
  1496. )*
  1497. @
  1498. [\040\t]* # Nab whitespace.
  1499. (?:
  1500. \( # (
  1501. [^\\\x80-\xff\n\015()] * # normal*
  1502. (?: # (
  1503. (?: \\ [^\x80-\xff] |
  1504. \( # (
  1505. [^\\\x80-\xff\n\015()] * # normal*
  1506. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1507. \) # )
  1508. ) # special
  1509. [^\\\x80-\xff\n\015()] * # normal*
  1510. )* # )*
  1511. \) # )
  1512. [\040\t]* )* # If comment found, allow more spaces.
  1513. (?:
  1514. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1515. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1516. |
  1517. \[ # [
  1518. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1519. \] # ]
  1520. )
  1521. [\040\t]* # Nab whitespace.
  1522. (?:
  1523. \( # (
  1524. [^\\\x80-\xff\n\015()] * # normal*
  1525. (?: # (
  1526. (?: \\ [^\x80-\xff] |
  1527. \( # (
  1528. [^\\\x80-\xff\n\015()] * # normal*
  1529. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1530. \) # )
  1531. ) # special
  1532. [^\\\x80-\xff\n\015()] * # normal*
  1533. )* # )*
  1534. \) # )
  1535. [\040\t]* )* # If comment found, allow more spaces.
  1536. # optional trailing comments
  1537. (?:
  1538. \.
  1539. [\040\t]* # Nab whitespace.
  1540. (?:
  1541. \( # (
  1542. [^\\\x80-\xff\n\015()] * # normal*
  1543. (?: # (
  1544. (?: \\ [^\x80-\xff] |
  1545. \( # (
  1546. [^\\\x80-\xff\n\015()] * # normal*
  1547. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1548. \) # )
  1549. ) # special
  1550. [^\\\x80-\xff\n\015()] * # normal*
  1551. )* # )*
  1552. \) # )
  1553. [\040\t]* )* # If comment found, allow more spaces.
  1554. (?:
  1555. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1556. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1557. |
  1558. \[ # [
  1559. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1560. \] # ]
  1561. )
  1562. [\040\t]* # Nab whitespace.
  1563. (?:
  1564. \( # (
  1565. [^\\\x80-\xff\n\015()] * # normal*
  1566. (?: # (
  1567. (?: \\ [^\x80-\xff] |
  1568. \( # (
  1569. [^\\\x80-\xff\n\015()] * # normal*
  1570. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1571. \) # )
  1572. ) # special
  1573. [^\\\x80-\xff\n\015()] * # normal*
  1574. )* # )*
  1575. \) # )
  1576. [\040\t]* )* # If comment found, allow more spaces.
  1577. # optional trailing comments
  1578. )*
  1579. # address spec
  1580. > # >
  1581. # name and address
  1582. )
  1583. /x
  1584. Alan Other <user\@dom.ain>
  1585. <user\@dom.ain>
  1586. user\@dom.ain
  1587. \"A. Other\" <user.1234\@dom.ain> (a comment)
  1588. A. Other <user.1234\@dom.ain> (a comment)
  1589. \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
  1590. A missing angle <user\@some.where
  1591. \= Expect no match
  1592. The quick brown fox
  1593. /abc\0def\00pqr\000xyz\0000AB/
  1594. abc\0def\00pqr\000xyz\0000AB
  1595. abc456 abc\0def\00pqr\000xyz\0000ABCDE
  1596. /abc\x0def\x00pqr\x000xyz\x0000AB/
  1597. abc\x0def\x00pqr\x000xyz\x0000AB
  1598. abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
  1599. /^[\000-\037]/
  1600. \0A
  1601. \01B
  1602. \037C
  1603. /\0*/
  1604. \0\0\0\0
  1605. /A\x0{2,3}Z/
  1606. The A\x0\x0Z
  1607. An A\0\x0\0Z
  1608. \= Expect no match
  1609. A\0Z
  1610. A\0\x0\0\x0Z
  1611. /^\s/
  1612. \040abc
  1613. \x0cabc
  1614. \nabc
  1615. \rabc
  1616. \tabc
  1617. \= Expect no match
  1618. abc
  1619. /^a b
  1620. c/x
  1621. abc
  1622. /ab{1,3}bc/
  1623. abbbbc
  1624. abbbc
  1625. abbc
  1626. \= Expect no match
  1627. abc
  1628. abbbbbc
  1629. /([^.]*)\.([^:]*):[T ]+(.*)/
  1630. track1.title:TBlah blah blah
  1631. /([^.]*)\.([^:]*):[T ]+(.*)/i
  1632. track1.title:TBlah blah blah
  1633. /([^.]*)\.([^:]*):[t ]+(.*)/i
  1634. track1.title:TBlah blah blah
  1635. /^[W-c]+$/
  1636. WXY_^abc
  1637. \= Expect no match
  1638. wxy
  1639. /^[W-c]+$/i
  1640. WXY_^abc
  1641. wxy_^ABC
  1642. /^[\x3f-\x5F]+$/i
  1643. WXY_^abc
  1644. wxy_^ABC
  1645. /^abc$/m
  1646. abc
  1647. qqq\nabc
  1648. abc\nzzz
  1649. qqq\nabc\nzzz
  1650. /^abc$/
  1651. abc
  1652. \= Expect no match
  1653. qqq\nabc
  1654. abc\nzzz
  1655. qqq\nabc\nzzz
  1656. /\Aabc\Z/m
  1657. abc
  1658. abc\n
  1659. \= Expect no match
  1660. qqq\nabc
  1661. abc\nzzz
  1662. qqq\nabc\nzzz
  1663. /\A(.)*\Z/s
  1664. abc\ndef
  1665. /\A(.)*\Z/m
  1666. \= Expect no match
  1667. abc\ndef
  1668. /(?:b)|(?::+)/
  1669. b::c
  1670. c::b
  1671. /[-az]+/
  1672. az-
  1673. \= Expect no match
  1674. b
  1675. /[az-]+/
  1676. za-
  1677. \= Expect no match
  1678. b
  1679. /[a\-z]+/
  1680. a-z
  1681. \= Expect no match
  1682. b
  1683. /[a-z]+/
  1684. abcdxyz
  1685. /[\d-]+/
  1686. 12-34
  1687. \= Expect no match
  1688. aaa
  1689. /\x5c/
  1690. \\
  1691. /\x20Z/
  1692. the Zoo
  1693. \= Expect no match
  1694. Zulu
  1695. /ab{3cd/
  1696. ab{3cd
  1697. /ab{3,cd/
  1698. ab{3,cd
  1699. /ab{3,4a}cd/
  1700. ab{3,4a}cd
  1701. /{4,5a}bc/
  1702. {4,5a}bc
  1703. /^a.b/newline=lf
  1704. a\rb
  1705. \= Expect no match
  1706. a\nb
  1707. /abc$/
  1708. abc
  1709. abc\n
  1710. \= Expect no match
  1711. abc\ndef
  1712. /(abc)\123/
  1713. abc\x53
  1714. /(abc)\223/
  1715. abc\x93
  1716. /(abc)\323/
  1717. abc\xd3
  1718. /(abc)\100/
  1719. abc\x40
  1720. abc\100
  1721. /(abc)\1000/
  1722. abc\x400
  1723. abc\x40\x30
  1724. abc\1000
  1725. abc\100\x30
  1726. abc\100\060
  1727. abc\100\60
  1728. /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
  1729. abcdefghijk\12S
  1730. /a{0}bc/
  1731. bc
  1732. /(a|(bc)){0,0}?xyz/
  1733. xyz
  1734. /abc[\10]de/
  1735. abc\010de
  1736. /abc[\1]de/
  1737. abc\1de
  1738. /(abc)[\1]de/
  1739. abc\1de
  1740. /(?s)a.b/
  1741. a\nb
  1742. /^([^a])([^\b])([^c]*)([^d]{3,4})/
  1743. baNOTccccd
  1744. baNOTcccd
  1745. baNOTccd
  1746. bacccd
  1747. \= Expect no match
  1748. anything
  1749. b\bc
  1750. baccd
  1751. /[^a]/
  1752. Abc
  1753. /[^a]/i
  1754. Abc
  1755. /[^a]+/
  1756. AAAaAbc
  1757. /[^a]+/i
  1758. AAAaAbc
  1759. /[^a]+/
  1760. bbb\nccc
  1761. /[^k]$/
  1762. abc
  1763. \= Expect no match
  1764. abk
  1765. /[^k]{2,3}$/
  1766. abc
  1767. kbc
  1768. kabc
  1769. \= Expect no match
  1770. abk
  1771. akb
  1772. akk
  1773. /^\d{8,}\@.+[^k]$/
  1774. 12345678\@a.b.c.d
  1775. 123456789\@x.y.z
  1776. \= Expect no match
  1777. 12345678\@x.y.uk
  1778. 1234567\@a.b.c.d
  1779. /[^a]/
  1780. aaaabcd
  1781. aaAabcd
  1782. /[^a]/i
  1783. aaaabcd
  1784. aaAabcd
  1785. /[^az]/
  1786. aaaabcd
  1787. aaAabcd
  1788. /[^az]/i
  1789. aaaabcd
  1790. aaAabcd
  1791. /\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/
  1792. \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377
  1793. /P[^*]TAIRE[^*]{1,6}?LL/
  1794. xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
  1795. /P[^*]TAIRE[^*]{1,}?LL/
  1796. xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
  1797. /(\.\d\d[1-9]?)\d+/
  1798. 1.230003938
  1799. 1.875000282
  1800. 1.235
  1801. /(\.\d\d((?=0)|\d(?=\d)))/
  1802. 1.230003938
  1803. 1.875000282
  1804. \= Expect no match
  1805. 1.235
  1806. /a(?)b/
  1807. ab
  1808. /\b(foo)\s+(\w+)/i
  1809. Food is on the foo table
  1810. /foo(.*)bar/
  1811. The food is under the bar in the barn.
  1812. /foo(.*?)bar/
  1813. The food is under the bar in the barn.
  1814. /(.*)(\d*)/no_auto_possess
  1815. I have 2 numbers: 53147
  1816. /(.*)(\d+)/
  1817. I have 2 numbers: 53147
  1818. /(.*?)(\d*)/no_auto_possess
  1819. I have 2 numbers: 53147
  1820. /(.*?)(\d+)/
  1821. I have 2 numbers: 53147
  1822. /(.*)(\d+)$/
  1823. I have 2 numbers: 53147
  1824. /(.*?)(\d+)$/
  1825. I have 2 numbers: 53147
  1826. /(.*)\b(\d+)$/
  1827. I have 2 numbers: 53147
  1828. /(.*\D)(\d+)$/
  1829. I have 2 numbers: 53147
  1830. /^\D*(?!123)/
  1831. ABC123
  1832. /^(\D*)(?=\d)(?!123)/
  1833. ABC445
  1834. \= Expect no match
  1835. ABC123
  1836. /^[W-]46]/
  1837. W46]789
  1838. -46]789
  1839. \= Expect no match
  1840. Wall
  1841. Zebra
  1842. 42
  1843. [abcd]
  1844. ]abcd[
  1845. /^[W-\]46]/
  1846. W46]789
  1847. Wall
  1848. Zebra
  1849. Xylophone
  1850. 42
  1851. [abcd]
  1852. ]abcd[
  1853. \\backslash
  1854. \= Expect no match
  1855. -46]789
  1856. well
  1857. /\d\d\/\d\d\/\d\d\d\d/
  1858. 01/01/2000
  1859. /word (?:[a-zA-Z0-9]+ ){0,10}otherword/
  1860. word cat dog elephant mussel cow horse canary baboon snake shark otherword
  1861. \= Expect no match
  1862. word cat dog elephant mussel cow horse canary baboon snake shark
  1863. /word (?:[a-zA-Z0-9]+ ){0,300}otherword/
  1864. \= Expect no match
  1865. word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
  1866. /^(a){0,0}/
  1867. bcd
  1868. abc
  1869. aab
  1870. /^(a){0,1}/
  1871. bcd
  1872. abc
  1873. aab
  1874. /^(a){0,2}/
  1875. bcd
  1876. abc
  1877. aab
  1878. /^(a){0,3}/
  1879. bcd
  1880. abc
  1881. aab
  1882. aaa
  1883. /^(a){0,}/
  1884. bcd
  1885. abc
  1886. aab
  1887. aaa
  1888. aaaaaaaa
  1889. /^(a){1,1}/
  1890. abc
  1891. aab
  1892. \= Expect no match
  1893. bcd
  1894. /^(a){1,2}/
  1895. abc
  1896. aab
  1897. \= Expect no match
  1898. bcd
  1899. /^(a){1,3}/
  1900. abc
  1901. aab
  1902. aaa
  1903. \= Expect no match
  1904. bcd
  1905. /^(a){1,}/
  1906. abc
  1907. aab
  1908. aaa
  1909. aaaaaaaa
  1910. \= Expect no match
  1911. bcd
  1912. /.*\.gif/
  1913. borfle\nbib.gif\nno
  1914. /.{0,}\.gif/
  1915. borfle\nbib.gif\nno
  1916. /.*\.gif/m
  1917. borfle\nbib.gif\nno
  1918. /.*\.gif/s
  1919. borfle\nbib.gif\nno
  1920. /.*\.gif/ms
  1921. borfle\nbib.gif\nno
  1922. /.*$/
  1923. borfle\nbib.gif\nno
  1924. /.*$/m
  1925. borfle\nbib.gif\nno
  1926. /.*$/s
  1927. borfle\nbib.gif\nno
  1928. /.*$/ms
  1929. borfle\nbib.gif\nno
  1930. /.*$/
  1931. borfle\nbib.gif\nno\n
  1932. /.*$/m
  1933. borfle\nbib.gif\nno\n
  1934. /.*$/s
  1935. borfle\nbib.gif\nno\n
  1936. /.*$/ms
  1937. borfle\nbib.gif\nno\n
  1938. /(.*X|^B)/
  1939. abcde\n1234Xyz
  1940. BarFoo
  1941. \= Expect no match
  1942. abcde\nBar
  1943. /(.*X|^B)/m
  1944. abcde\n1234Xyz
  1945. BarFoo
  1946. abcde\nBar
  1947. /(.*X|^B)/s
  1948. abcde\n1234Xyz
  1949. BarFoo
  1950. \= Expect no match
  1951. abcde\nBar
  1952. /(.*X|^B)/ms
  1953. abcde\n1234Xyz
  1954. BarFoo
  1955. abcde\nBar
  1956. /(?s)(.*X|^B)/
  1957. abcde\n1234Xyz
  1958. BarFoo
  1959. \= Expect no match
  1960. abcde\nBar
  1961. /(?s:.*X|^B)/
  1962. abcde\n1234Xyz
  1963. BarFoo
  1964. \= Expect no match
  1965. abcde\nBar
  1966. /^.*B/
  1967. \= Expect no match
  1968. abc\nB
  1969. /(?s)^.*B/
  1970. abc\nB
  1971. /(?m)^.*B/
  1972. abc\nB
  1973. /(?ms)^.*B/
  1974. abc\nB
  1975. /(?ms)^B/
  1976. abc\nB
  1977. /(?s)B$/
  1978. B\n
  1979. /^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
  1980. 123456654321
  1981. /^\d\d\d\d\d\d\d\d\d\d\d\d/
  1982. 123456654321
  1983. /^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
  1984. 123456654321
  1985. /^[abc]{12}/
  1986. abcabcabcabc
  1987. /^[a-c]{12}/
  1988. abcabcabcabc
  1989. /^(a|b|c){12}/
  1990. abcabcabcabc
  1991. /^[abcdefghijklmnopqrstuvwxy0123456789]/
  1992. n
  1993. \= Expect no match
  1994. z
  1995. /abcde{0,0}/
  1996. abcd
  1997. \= Expect no match
  1998. abce
  1999. /ab[cd]{0,0}e/
  2000. abe
  2001. \= Expect no match
  2002. abcde
  2003. /ab(c){0,0}d/
  2004. abd
  2005. \= Expect no match
  2006. abcd
  2007. /a(b*)/
  2008. a
  2009. ab
  2010. abbbb
  2011. \= Expect no match
  2012. bbbbb
  2013. /ab\d{0}e/
  2014. abe
  2015. \= Expect no match
  2016. ab1e
  2017. /"([^\\"]+|\\.)*"/
  2018. the \"quick\" brown fox
  2019. \"the \\\"quick\\\" brown fox\"
  2020. /.*?/g,aftertext
  2021. abc
  2022. /\b/g,aftertext
  2023. abc
  2024. /\b/g,aftertext
  2025. abc
  2026. //g
  2027. abc
  2028. /<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/is
  2029. <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
  2030. /a[^a]b/
  2031. acb
  2032. a\nb
  2033. /a.b/
  2034. acb
  2035. \= Expect no match
  2036. a\nb
  2037. /a[^a]b/s
  2038. acb
  2039. a\nb
  2040. /a.b/s
  2041. acb
  2042. a\nb
  2043. /^(b+?|a){1,2}?c/
  2044. bac
  2045. bbac
  2046. bbbac
  2047. bbbbac
  2048. bbbbbac
  2049. /^(b+|a){1,2}?c/
  2050. bac
  2051. bbac
  2052. bbbac
  2053. bbbbac
  2054. bbbbbac
  2055. /(?!\A)x/m
  2056. a\bx\n
  2057. \= Expect no match
  2058. x\nb\n
  2059. /\x0{ab}/
  2060. \0{ab}
  2061. /(A|B)*?CD/
  2062. CD
  2063. /(A|B)*CD/
  2064. CD
  2065. /(?<!bar)foo/
  2066. foo
  2067. catfood
  2068. arfootle
  2069. rfoosh
  2070. \= Expect no match
  2071. barfoo
  2072. towbarfoo
  2073. /\w{3}(?<!bar)foo/
  2074. catfood
  2075. \= Expect no match
  2076. foo
  2077. barfoo
  2078. towbarfoo
  2079. /(?<=(foo)a)bar/
  2080. fooabar
  2081. \= Expect no match
  2082. bar
  2083. foobbar
  2084. /\Aabc\z/m
  2085. abc
  2086. \= Expect no match
  2087. abc\n
  2088. qqq\nabc
  2089. abc\nzzz
  2090. qqq\nabc\nzzz
  2091. "(?>.*/)foo"
  2092. \= Expect no match
  2093. /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
  2094. "(?>.*/)foo"
  2095. /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
  2096. /(?>(\.\d\d[1-9]?))\d+/
  2097. 1.230003938
  2098. 1.875000282
  2099. \= Expect no match
  2100. 1.235
  2101. /^((?>\w+)|(?>\s+))*$/
  2102. now is the time for all good men to come to the aid of the party
  2103. \= Expect no match
  2104. this is not a line with only words and spaces!
  2105. /(\d+)(\w)/
  2106. 12345a
  2107. 12345+
  2108. /((?>\d+))(\w)/
  2109. 12345a
  2110. \= Expect no match
  2111. 12345+
  2112. /(?>a+)b/
  2113. aaab
  2114. /((?>a+)b)/
  2115. aaab
  2116. /(?>(a+))b/
  2117. aaab
  2118. /(?>b)+/
  2119. aaabbbccc
  2120. /(?>a+|b+|c+)*c/
  2121. aaabbbbccccd
  2122. /(a+|b+|c+)*c/
  2123. aaabbbbccccd
  2124. /((?>[^()]+)|\([^()]*\))+/
  2125. ((abc(ade)ufh()()x
  2126. /\(((?>[^()]+)|\([^()]+\))+\)/
  2127. (abc)
  2128. (abc(def)xyz)
  2129. \= Expect no match
  2130. ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  2131. /a(?-i)b/i
  2132. ab
  2133. Ab
  2134. \= Expect no match
  2135. aB
  2136. AB
  2137. /(a (?x)b c)d e/
  2138. a bcd e
  2139. \= Expect no match
  2140. a b cd e
  2141. abcd e
  2142. a bcde
  2143. /(a b(?x)c d (?-x)e f)/
  2144. a bcde f
  2145. \= Expect no match
  2146. abcdef
  2147. /(a(?i)b)c/
  2148. abc
  2149. aBc
  2150. \= Expect no match
  2151. abC
  2152. aBC
  2153. Abc
  2154. ABc
  2155. ABC
  2156. AbC
  2157. /a(?i:b)c/
  2158. abc
  2159. aBc
  2160. \= Expect no match
  2161. ABC
  2162. abC
  2163. aBC
  2164. /a(?i:b)*c/
  2165. aBc
  2166. aBBc
  2167. \= Expect no match
  2168. aBC
  2169. aBBC
  2170. /a(?=b(?i)c)\w\wd/
  2171. abcd
  2172. abCd
  2173. \= Expect no match
  2174. aBCd
  2175. abcD
  2176. /(?s-i:more.*than).*million/i
  2177. more than million
  2178. more than MILLION
  2179. more \n than Million
  2180. \= Expect no match
  2181. MORE THAN MILLION
  2182. more \n than \n million
  2183. /(?:(?s-i)more.*than).*million/i
  2184. more than million
  2185. more than MILLION
  2186. more \n than Million
  2187. \= Expect no match
  2188. MORE THAN MILLION
  2189. more \n than \n million
  2190. /(?>a(?i)b+)+c/
  2191. abc
  2192. aBbc
  2193. aBBc
  2194. \= Expect no match
  2195. Abc
  2196. abAb
  2197. abbC
  2198. /(?=a(?i)b)\w\wc/
  2199. abc
  2200. aBc
  2201. \= Expect no match
  2202. Ab
  2203. abC
  2204. aBC
  2205. /(?<=a(?i)b)(\w\w)c/
  2206. abxxc
  2207. aBxxc
  2208. \= Expect no match
  2209. Abxxc
  2210. ABxxc
  2211. abxxC
  2212. /^(?(?=abc)\w{3}:|\d\d)$/
  2213. abc:
  2214. 12
  2215. \= Expect no match
  2216. 123
  2217. xyz
  2218. /^(?(?!abc)\d\d|\w{3}:)$/
  2219. abc:
  2220. 12
  2221. \= Expect no match
  2222. 123
  2223. xyz
  2224. /(?(?<=foo)bar|cat)/
  2225. foobar
  2226. cat
  2227. fcat
  2228. focat
  2229. \= Expect no match
  2230. foocat
  2231. /(?(?<!foo)cat|bar)/
  2232. foobar
  2233. cat
  2234. fcat
  2235. focat
  2236. \= Expect no match
  2237. foocat
  2238. /(?>a*)*/
  2239. a
  2240. aa
  2241. aaaa
  2242. /(abc|)+/
  2243. abc
  2244. abcabc
  2245. abcabcabc
  2246. xyz
  2247. /([a]*)*/
  2248. a
  2249. aaaaa
  2250. /([ab]*)*/
  2251. a
  2252. b
  2253. ababab
  2254. aaaabcde
  2255. bbbb
  2256. /([^a]*)*/
  2257. b
  2258. bbbb
  2259. aaa
  2260. /([^ab]*)*/
  2261. cccc
  2262. abab
  2263. /([a]*?)*/
  2264. a
  2265. aaaa
  2266. /([ab]*?)*/
  2267. a
  2268. b
  2269. abab
  2270. baba
  2271. /([^a]*?)*/
  2272. b
  2273. bbbb
  2274. aaa
  2275. /([^ab]*?)*/
  2276. c
  2277. cccc
  2278. baba
  2279. /(?>a*)*/
  2280. a
  2281. aaabcde
  2282. /((?>a*))*/
  2283. aaaaa
  2284. aabbaa
  2285. /((?>a*?))*/
  2286. aaaaa
  2287. aabbaa
  2288. /(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x
  2289. 12-sep-98
  2290. 12-09-98
  2291. \= Expect no match
  2292. sep-12-98
  2293. /(?i:saturday|sunday)/
  2294. saturday
  2295. sunday
  2296. Saturday
  2297. Sunday
  2298. SATURDAY
  2299. SUNDAY
  2300. SunDay
  2301. /(a(?i)bc|BB)x/
  2302. abcx
  2303. aBCx
  2304. bbx
  2305. BBx
  2306. \= Expect no match
  2307. abcX
  2308. aBCX
  2309. bbX
  2310. BBX
  2311. /^([ab](?i)[cd]|[ef])/
  2312. ac
  2313. aC
  2314. bD
  2315. elephant
  2316. Europe
  2317. frog
  2318. France
  2319. \= Expect no match
  2320. Africa
  2321. /^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
  2322. ab
  2323. aBd
  2324. xy
  2325. xY
  2326. zebra
  2327. Zambesi
  2328. \= Expect no match
  2329. aCD
  2330. XY
  2331. /(?<=foo\n)^bar/m
  2332. foo\nbar
  2333. \= Expect no match
  2334. bar
  2335. baz\nbar
  2336. /(?<=(?<!foo)bar)baz/
  2337. barbaz
  2338. barbarbaz
  2339. koobarbaz
  2340. \= Expect no match
  2341. baz
  2342. foobarbaz
  2343. # The following tests are taken from the Perl 5.005 test suite; some of them
  2344. # are compatible with 5.004, but I'd rather not have to sort them out.
  2345. /abc/
  2346. abc
  2347. xabcy
  2348. ababc
  2349. \= Expect no match
  2350. xbc
  2351. axc
  2352. abx
  2353. /ab*c/
  2354. abc
  2355. /ab*bc/
  2356. abc
  2357. abbc
  2358. abbbbc
  2359. /.{1}/
  2360. abbbbc
  2361. /.{3,4}/
  2362. abbbbc
  2363. /ab{0,}bc/
  2364. abbbbc
  2365. /ab+bc/
  2366. abbc
  2367. \= Expect no match
  2368. abc
  2369. abq
  2370. /ab+bc/
  2371. abbbbc
  2372. /ab{1,}bc/
  2373. abbbbc
  2374. /ab{1,3}bc/
  2375. abbbbc
  2376. /ab{3,4}bc/
  2377. abbbbc
  2378. /ab{4,5}bc/
  2379. \= Expect no match
  2380. abq
  2381. abbbbc
  2382. /ab?bc/
  2383. abbc
  2384. abc
  2385. /ab{0,1}bc/
  2386. abc
  2387. /ab?bc/
  2388. /ab?c/
  2389. abc
  2390. /ab{0,1}c/
  2391. abc
  2392. /^abc$/
  2393. abc
  2394. \= Expect no match
  2395. abbbbc
  2396. abcc
  2397. /^abc/
  2398. abcc
  2399. /^abc$/
  2400. /abc$/
  2401. aabc
  2402. aabc
  2403. \= Expect no match
  2404. aabcd
  2405. /^/
  2406. abc
  2407. /$/
  2408. abc
  2409. /a.c/
  2410. abc
  2411. axc
  2412. /a.*c/
  2413. axyzc
  2414. /a[bc]d/
  2415. abd
  2416. \= Expect no match
  2417. axyzd
  2418. abc
  2419. /a[b-d]e/
  2420. ace
  2421. /a[b-d]/
  2422. aac
  2423. /a[-b]/
  2424. a-
  2425. /a[b-]/
  2426. a-
  2427. /a]/
  2428. a]
  2429. /a[]]b/
  2430. a]b
  2431. /a[^bc]d/
  2432. aed
  2433. \= Expect no match
  2434. abd
  2435. abd
  2436. /a[^-b]c/
  2437. adc
  2438. /a[^]b]c/
  2439. adc
  2440. a-c
  2441. \= Expect no match
  2442. a]c
  2443. /\ba\b/
  2444. a-
  2445. -a
  2446. -a-
  2447. /\by\b/
  2448. \= Expect no match
  2449. xy
  2450. yz
  2451. xyz
  2452. /\Ba\B/
  2453. \= Expect no match
  2454. a-
  2455. -a
  2456. -a-
  2457. /\By\b/
  2458. xy
  2459. /\by\B/
  2460. yz
  2461. /\By\B/
  2462. xyz
  2463. /\w/
  2464. a
  2465. /\W/
  2466. -
  2467. \= Expect no match
  2468. a
  2469. /a\sb/
  2470. a b
  2471. /a\Sb/
  2472. a-b
  2473. \= Expect no match
  2474. a b
  2475. /\d/
  2476. 1
  2477. /\D/
  2478. -
  2479. \= Expect no match
  2480. 1
  2481. /[\w]/
  2482. a
  2483. /[\W]/
  2484. -
  2485. \= Expect no match
  2486. a
  2487. /a[\s]b/
  2488. a b
  2489. /a[\S]b/
  2490. a-b
  2491. \= Expect no match
  2492. a b
  2493. /[\d]/
  2494. 1
  2495. /[\D]/
  2496. -
  2497. \= Expect no match
  2498. 1
  2499. /ab|cd/
  2500. abc
  2501. abcd
  2502. /()ef/
  2503. def
  2504. /$b/
  2505. /a\(b/
  2506. a(b
  2507. /a\(*b/
  2508. ab
  2509. a((b
  2510. /a\\b/
  2511. a\\b
  2512. \= Expect no match
  2513. a\b
  2514. /((a))/
  2515. abc
  2516. /(a)b(c)/
  2517. abc
  2518. /a+b+c/
  2519. aabbabc
  2520. /a{1,}b{1,}c/
  2521. aabbabc
  2522. /a.+?c/
  2523. abcabc
  2524. /(a+|b)*/
  2525. ab
  2526. /(a+|b){0,}/
  2527. ab
  2528. /(a+|b)+/
  2529. ab
  2530. /(a+|b){1,}/
  2531. ab
  2532. /(a+|b)?/
  2533. ab
  2534. /(a+|b){0,1}/
  2535. ab
  2536. /[^ab]*/
  2537. cde
  2538. /abc/
  2539. \= Expect no match
  2540. b
  2541. /a*/
  2542. /([abc])*d/
  2543. abbbcd
  2544. /([abc])*bcd/
  2545. abcd
  2546. /a|b|c|d|e/
  2547. e
  2548. /(a|b|c|d|e)f/
  2549. ef
  2550. /abcd*efg/
  2551. abcdefg
  2552. /ab*/
  2553. xabyabbbz
  2554. xayabbbz
  2555. /(ab|cd)e/
  2556. abcde
  2557. /[abhgefdc]ij/
  2558. hij
  2559. /^(ab|cd)e/
  2560. /(abc|)ef/
  2561. abcdef
  2562. /(a|b)c*d/
  2563. abcd
  2564. /(ab|ab*)bc/
  2565. abc
  2566. /a([bc]*)c*/
  2567. abc
  2568. /a([bc]*)(c*d)/
  2569. abcd
  2570. /a([bc]+)(c*d)/
  2571. abcd
  2572. /a([bc]*)(c+d)/
  2573. abcd
  2574. /a[bcd]*dcdcde/
  2575. adcdcde
  2576. /a[bcd]+dcdcde/
  2577. \= Expect no match
  2578. abcde
  2579. adcdcde
  2580. /(ab|a)b*c/
  2581. abc
  2582. /((a)(b)c)(d)/
  2583. abcd
  2584. /[a-zA-Z_][a-zA-Z0-9_]*/
  2585. alpha
  2586. /^a(bc+|b[eh])g|.h$/
  2587. abh
  2588. /(bc+d$|ef*g.|h?i(j|k))/
  2589. effgz
  2590. ij
  2591. reffgz
  2592. \= Expect no match
  2593. effg
  2594. bcdd
  2595. /((((((((((a))))))))))/
  2596. a
  2597. /(((((((((a)))))))))/
  2598. a
  2599. /multiple words of text/
  2600. \= Expect no match
  2601. aa
  2602. uh-uh
  2603. /multiple words/
  2604. multiple words, yeah
  2605. /(.*)c(.*)/
  2606. abcde
  2607. /\((.*), (.*)\)/
  2608. (a, b)
  2609. /[k]/
  2610. /abcd/
  2611. abcd
  2612. /a(bc)d/
  2613. abcd
  2614. /a[-]?c/
  2615. ac
  2616. /abc/i
  2617. ABC
  2618. XABCY
  2619. ABABC
  2620. \= Expect no match
  2621. aaxabxbaxbbx
  2622. XBC
  2623. AXC
  2624. ABX
  2625. /ab*c/i
  2626. ABC
  2627. /ab*bc/i
  2628. ABC
  2629. ABBC
  2630. /ab*?bc/i
  2631. ABBBBC
  2632. /ab{0,}?bc/i
  2633. ABBBBC
  2634. /ab+?bc/i
  2635. ABBC
  2636. /ab+bc/i
  2637. \= Expect no match
  2638. ABC
  2639. ABQ
  2640. /ab{1,}bc/i
  2641. /ab+bc/i
  2642. ABBBBC
  2643. /ab{1,}?bc/i
  2644. ABBBBC
  2645. /ab{1,3}?bc/i
  2646. ABBBBC
  2647. /ab{3,4}?bc/i
  2648. ABBBBC
  2649. /ab{4,5}?bc/i
  2650. \= Expect no match
  2651. ABQ
  2652. ABBBBC
  2653. /ab??bc/i
  2654. ABBC
  2655. ABC
  2656. /ab{0,1}?bc/i
  2657. ABC
  2658. /ab??bc/i
  2659. /ab??c/i
  2660. ABC
  2661. /ab{0,1}?c/i
  2662. ABC
  2663. /^abc$/i
  2664. ABC
  2665. \= Expect no match
  2666. ABBBBC
  2667. ABCC
  2668. /^abc/i
  2669. ABCC
  2670. /^abc$/i
  2671. /abc$/i
  2672. AABC
  2673. /^/i
  2674. ABC
  2675. /$/i
  2676. ABC
  2677. /a.c/i
  2678. ABC
  2679. AXC
  2680. /a.*?c/i
  2681. AXYZC
  2682. /a.*c/i
  2683. AABC
  2684. \= Expect no match
  2685. AXYZD
  2686. /a[bc]d/i
  2687. ABD
  2688. /a[b-d]e/i
  2689. ACE
  2690. \= Expect no match
  2691. ABC
  2692. ABD
  2693. /a[b-d]/i
  2694. AAC
  2695. /a[-b]/i
  2696. A-
  2697. /a[b-]/i
  2698. A-
  2699. /a]/i
  2700. A]
  2701. /a[]]b/i
  2702. A]B
  2703. /a[^bc]d/i
  2704. AED
  2705. /a[^-b]c/i
  2706. ADC
  2707. \= Expect no match
  2708. ABD
  2709. A-C
  2710. /a[^]b]c/i
  2711. ADC
  2712. /ab|cd/i
  2713. ABC
  2714. ABCD
  2715. /()ef/i
  2716. DEF
  2717. /$b/i
  2718. \= Expect no match
  2719. A]C
  2720. B
  2721. /a\(b/i
  2722. A(B
  2723. /a\(*b/i
  2724. AB
  2725. A((B
  2726. /a\\b/i
  2727. \= Expect no match
  2728. A\=notbol
  2729. /((a))/i
  2730. ABC
  2731. /(a)b(c)/i
  2732. ABC
  2733. /a+b+c/i
  2734. AABBABC
  2735. /a{1,}b{1,}c/i
  2736. AABBABC
  2737. /a.+?c/i
  2738. ABCABC
  2739. /a.*?c/i
  2740. ABCABC
  2741. /a.{0,5}?c/i
  2742. ABCABC
  2743. /(a+|b)*/i
  2744. AB
  2745. /(a+|b){0,}/i
  2746. AB
  2747. /(a+|b)+/i
  2748. AB
  2749. /(a+|b){1,}/i
  2750. AB
  2751. /(a+|b)?/i
  2752. AB
  2753. /(a+|b){0,1}/i
  2754. AB
  2755. /(a+|b){0,1}?/i
  2756. AB
  2757. /[^ab]*/i
  2758. CDE
  2759. /abc/i
  2760. /a*/i
  2761. /([abc])*d/i
  2762. ABBBCD
  2763. /([abc])*bcd/i
  2764. ABCD
  2765. /a|b|c|d|e/i
  2766. E
  2767. /(a|b|c|d|e)f/i
  2768. EF
  2769. /abcd*efg/i
  2770. ABCDEFG
  2771. /ab*/i
  2772. XABYABBBZ
  2773. XAYABBBZ
  2774. /(ab|cd)e/i
  2775. ABCDE
  2776. /[abhgefdc]ij/i
  2777. HIJ
  2778. /^(ab|cd)e/i
  2779. \= Expect no match
  2780. ABCDE
  2781. /(abc|)ef/i
  2782. ABCDEF
  2783. /(a|b)c*d/i
  2784. ABCD
  2785. /(ab|ab*)bc/i
  2786. ABC
  2787. /a([bc]*)c*/i
  2788. ABC
  2789. /a([bc]*)(c*d)/i
  2790. ABCD
  2791. /a([bc]+)(c*d)/i
  2792. ABCD
  2793. /a([bc]*)(c+d)/i
  2794. ABCD
  2795. /a[bcd]*dcdcde/i
  2796. ADCDCDE
  2797. /a[bcd]+dcdcde/i
  2798. /(ab|a)b*c/i
  2799. ABC
  2800. /((a)(b)c)(d)/i
  2801. ABCD
  2802. /[a-zA-Z_][a-zA-Z0-9_]*/i
  2803. ALPHA
  2804. /^a(bc+|b[eh])g|.h$/i
  2805. ABH
  2806. /(bc+d$|ef*g.|h?i(j|k))/i
  2807. EFFGZ
  2808. IJ
  2809. REFFGZ
  2810. \= Expect no match
  2811. ADCDCDE
  2812. EFFG
  2813. BCDD
  2814. /((((((((((a))))))))))/i
  2815. A
  2816. /(((((((((a)))))))))/i
  2817. A
  2818. /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
  2819. A
  2820. /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
  2821. C
  2822. /multiple words of text/i
  2823. \= Expect no match
  2824. AA
  2825. UH-UH
  2826. /multiple words/i
  2827. MULTIPLE WORDS, YEAH
  2828. /(.*)c(.*)/i
  2829. ABCDE
  2830. /\((.*), (.*)\)/i
  2831. (A, B)
  2832. /[k]/i
  2833. /abcd/i
  2834. ABCD
  2835. /a(bc)d/i
  2836. ABCD
  2837. /a[-]?c/i
  2838. AC
  2839. /a(?!b)./
  2840. abad
  2841. /a(?=d)./
  2842. abad
  2843. /a(?=c|d)./
  2844. abad
  2845. /a(?:b|c|d)(.)/
  2846. ace
  2847. /a(?:b|c|d)*(.)/
  2848. ace
  2849. /a(?:b|c|d)+?(.)/
  2850. ace
  2851. acdbcdbe
  2852. /a(?:b|c|d)+(.)/
  2853. acdbcdbe
  2854. /a(?:b|c|d){2}(.)/
  2855. acdbcdbe
  2856. /a(?:b|c|d){4,5}(.)/
  2857. acdbcdbe
  2858. /a(?:b|c|d){4,5}?(.)/
  2859. acdbcdbe
  2860. /((foo)|(bar))*/
  2861. foobar
  2862. /a(?:b|c|d){6,7}(.)/
  2863. acdbcdbe
  2864. /a(?:b|c|d){6,7}?(.)/
  2865. acdbcdbe
  2866. /a(?:b|c|d){5,6}(.)/
  2867. acdbcdbe
  2868. /a(?:b|c|d){5,6}?(.)/
  2869. acdbcdbe
  2870. /a(?:b|c|d){5,7}(.)/
  2871. acdbcdbe
  2872. /a(?:b|c|d){5,7}?(.)/
  2873. acdbcdbe
  2874. /a(?:b|(c|e){1,2}?|d)+?(.)/
  2875. ace
  2876. /^(.+)?B/
  2877. AB
  2878. /^([^a-z])|(\^)$/
  2879. .
  2880. /^[<>]&/
  2881. <&OUT
  2882. /(?:(f)(o)(o)|(b)(a)(r))*/
  2883. foobar
  2884. /(?<=a)b/
  2885. ab
  2886. \= Expect no match
  2887. cb
  2888. b
  2889. /(?<!c)b/
  2890. ab
  2891. b
  2892. b
  2893. /(?:..)*a/
  2894. aba
  2895. /(?:..)*?a/
  2896. aba
  2897. /^(){3,5}/
  2898. abc
  2899. /^(a+)*ax/
  2900. aax
  2901. /^((a|b)+)*ax/
  2902. aax
  2903. /^((a|bc)+)*ax/
  2904. aax
  2905. /(a|x)*ab/
  2906. cab
  2907. /(a)*ab/
  2908. cab
  2909. /(?:(?i)a)b/
  2910. ab
  2911. /((?i)a)b/
  2912. ab
  2913. /(?:(?i)a)b/
  2914. Ab
  2915. /((?i)a)b/
  2916. Ab
  2917. /(?:(?i)a)b/
  2918. \= Expect no match
  2919. cb
  2920. aB
  2921. /((?i)a)b/
  2922. /(?i:a)b/
  2923. ab
  2924. /((?i:a))b/
  2925. ab
  2926. /(?i:a)b/
  2927. Ab
  2928. /((?i:a))b/
  2929. Ab
  2930. /(?i:a)b/
  2931. \= Expect no match
  2932. aB
  2933. aB
  2934. /((?i:a))b/
  2935. /(?:(?-i)a)b/i
  2936. ab
  2937. /((?-i)a)b/i
  2938. ab
  2939. /(?:(?-i)a)b/i
  2940. aB
  2941. /((?-i)a)b/i
  2942. aB
  2943. /(?:(?-i)a)b/i
  2944. aB
  2945. \= Expect no match
  2946. Ab
  2947. /((?-i)a)b/i
  2948. /(?:(?-i)a)b/i
  2949. aB
  2950. /((?-i)a)b/i
  2951. aB
  2952. /(?:(?-i)a)b/i
  2953. \= Expect no match
  2954. Ab
  2955. AB
  2956. /((?-i)a)b/i
  2957. /(?-i:a)b/i
  2958. ab
  2959. /((?-i:a))b/i
  2960. ab
  2961. /(?-i:a)b/i
  2962. aB
  2963. /((?-i:a))b/i
  2964. aB
  2965. /(?-i:a)b/i
  2966. \= Expect no match
  2967. AB
  2968. Ab
  2969. /((?-i:a))b/i
  2970. /(?-i:a)b/i
  2971. aB
  2972. /((?-i:a))b/i
  2973. aB
  2974. /(?-i:a)b/i
  2975. \= Expect no match
  2976. Ab
  2977. AB
  2978. /((?-i:a))b/i
  2979. /((?-i:a.))b/i
  2980. \= Expect no match
  2981. AB
  2982. a\nB
  2983. /((?s-i:a.))b/i
  2984. a\nB
  2985. /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
  2986. cabbbb
  2987. /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
  2988. caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
  2989. /foo\w*\d{4}baz/
  2990. foobar1234baz
  2991. /x(~~)*(?:(?:F)?)?/
  2992. x~~
  2993. /^a(?#xxx){3}c/
  2994. aaac
  2995. /^a (?#xxx) (?#yyy) {3}c/x
  2996. aaac
  2997. /(?<![cd])b/
  2998. \= Expect no match
  2999. B\nB
  3000. dbcb
  3001. /(?<![cd])[ab]/
  3002. dbaacb
  3003. /(?<!(c|d))b/
  3004. /(?<!(c|d))[ab]/
  3005. dbaacb
  3006. /(?<!cd)[ab]/
  3007. cdaccb
  3008. /^(?:a?b?)*$/
  3009. \= Expect no match
  3010. dbcb
  3011. a--
  3012. /((?s)^a(.))((?m)^b$)/
  3013. a\nb\nc\n
  3014. /((?m)^b$)/
  3015. a\nb\nc\n
  3016. /(?m)^b/
  3017. a\nb\n
  3018. /(?m)^(b)/
  3019. a\nb\n
  3020. /((?m)^b)/
  3021. a\nb\n
  3022. /\n((?m)^b)/
  3023. a\nb\n
  3024. /((?s).)c(?!.)/
  3025. a\nb\nc\n
  3026. a\nb\nc\n
  3027. /((?s)b.)c(?!.)/
  3028. a\nb\nc\n
  3029. a\nb\nc\n
  3030. /^b/
  3031. /()^b/
  3032. \= Expect no match
  3033. a\nb\nc\n
  3034. a\nb\nc\n
  3035. /((?m)^b)/
  3036. a\nb\nc\n
  3037. /(?(?!a)a|b)/
  3038. /(?(?!a)b|a)/
  3039. a
  3040. /(?(?=a)b|a)/
  3041. \= Expect no match
  3042. a
  3043. a
  3044. /(?(?=a)a|b)/
  3045. a
  3046. /(\w+:)+/
  3047. one:
  3048. /$(?<=^(a))/
  3049. a
  3050. /([\w:]+::)?(\w+)$/
  3051. abcd
  3052. xy:z:::abcd
  3053. /^[^bcd]*(c+)/
  3054. aexycd
  3055. /(a*)b+/
  3056. caab
  3057. /([\w:]+::)?(\w+)$/
  3058. abcd
  3059. xy:z:::abcd
  3060. \= Expect no match
  3061. abcd:
  3062. abcd:
  3063. /^[^bcd]*(c+)/
  3064. aexycd
  3065. /(>a+)ab/
  3066. /(?>a+)b/
  3067. aaab
  3068. /([[:]+)/
  3069. a:[b]:
  3070. /([[=]+)/
  3071. a=[b]=
  3072. /([[.]+)/
  3073. a.[b].
  3074. /((?>a+)b)/
  3075. aaab
  3076. /(?>(a+))b/
  3077. aaab
  3078. /((?>[^()]+)|\([^()]*\))+/
  3079. ((abc(ade)ufh()()x
  3080. /a\Z/
  3081. \= Expect no match
  3082. aaab
  3083. a\nb\n
  3084. /b\Z/
  3085. a\nb\n
  3086. /b\z/
  3087. /b\Z/
  3088. a\nb
  3089. /b\z/
  3090. a\nb
  3091. /(?>.*)(?<=(abcd|wxyz))/
  3092. alphabetabcd
  3093. endingwxyz
  3094. \= Expect no match
  3095. a rather long string that doesn't end with one of them
  3096. /word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
  3097. word cat dog elephant mussel cow horse canary baboon snake shark otherword
  3098. \= Expect no match
  3099. word cat dog elephant mussel cow horse canary baboon snake shark
  3100. /word (?>[a-zA-Z0-9]+ ){0,30}otherword/
  3101. \= Expect no match
  3102. word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
  3103. /(?<=\d{3}(?!999))foo/
  3104. 999foo
  3105. 123999foo
  3106. \= Expect no match
  3107. 123abcfoo
  3108. /(?<=(?!...999)\d{3})foo/
  3109. 999foo
  3110. 123999foo
  3111. \= Expect no match
  3112. 123abcfoo
  3113. /(?<=\d{3}(?!999)...)foo/
  3114. 123abcfoo
  3115. 123456foo
  3116. \= Expect no match
  3117. 123999foo
  3118. /(?<=\d{3}...)(?<!999)foo/
  3119. 123abcfoo
  3120. 123456foo
  3121. \= Expect no match
  3122. 123999foo
  3123. /((Z)+|A)*/
  3124. ZABCDEFG
  3125. /(Z()|A)*/
  3126. ZABCDEFG
  3127. /(Z(())|A)*/
  3128. ZABCDEFG
  3129. /((?>Z)+|A)*/
  3130. ZABCDEFG
  3131. /((?>)+|A)*/
  3132. ZABCDEFG
  3133. /a*/g
  3134. abbab
  3135. /[[:space:]]+/
  3136. > \x09\x0a\x0c\x0d\x0b<
  3137. /[[:blank:]]+/
  3138. > \x09\x0a\x0c\x0d\x0b<
  3139. /[\s]+/
  3140. > \x09\x0a\x0c\x0d\x0b<
  3141. /\s+/
  3142. > \x09\x0a\x0c\x0d\x0b<
  3143. /a b/x
  3144. ab
  3145. /(?!\A)x/m
  3146. a\nxb\n
  3147. /(?!^)x/m
  3148. \= Expect no match
  3149. a\nxb\n
  3150. /abc\Qabc\Eabc/
  3151. abcabcabc
  3152. /abc\Q(*+|\Eabc/
  3153. abc(*+|abc
  3154. / abc\Q abc\Eabc/x
  3155. abc abcabc
  3156. \= Expect no match
  3157. abcabcabc
  3158. /abc#comment
  3159. \Q#not comment
  3160. literal\E/x
  3161. abc#not comment\n literal
  3162. /abc#comment
  3163. \Q#not comment
  3164. literal/x
  3165. abc#not comment\n literal
  3166. /abc#comment
  3167. \Q#not comment
  3168. literal\E #more comment
  3169. /x
  3170. abc#not comment\n literal
  3171. /abc#comment
  3172. \Q#not comment
  3173. literal\E #more comment/x
  3174. abc#not comment\n literal
  3175. /\Qabc\$xyz\E/
  3176. abc\\\$xyz
  3177. /\Qabc\E\$\Qxyz\E/
  3178. abc\$xyz
  3179. /\Gabc/
  3180. abc
  3181. \= Expect no match
  3182. xyzabc
  3183. /\Gabc./g
  3184. abc1abc2xyzabc3
  3185. /abc./g
  3186. abc1abc2xyzabc3
  3187. /a(?x: b c )d/
  3188. XabcdY
  3189. \= Expect no match
  3190. Xa b c d Y
  3191. /((?x)x y z | a b c)/
  3192. XabcY
  3193. AxyzB
  3194. /(?i)AB(?-i)C/
  3195. XabCY
  3196. \= Expect no match
  3197. XabcY
  3198. /((?i)AB(?-i)C|D)E/
  3199. abCE
  3200. DE
  3201. \= Expect no match
  3202. abcE
  3203. abCe
  3204. dE
  3205. De
  3206. /[z\Qa-d]\E]/
  3207. z
  3208. a
  3209. -
  3210. d
  3211. ]
  3212. \= Expect no match
  3213. b
  3214. /(a+)*b/
  3215. \= Expect no match
  3216. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  3217. /(?i)reg(?:ul(?:[aä]|ae)r|ex)/
  3218. REGular
  3219. regulaer
  3220. Regex
  3221. regulär
  3222. /Åæåä[à-ÿÀ-ß]+/
  3223. Åæåäà
  3224. Åæåäÿ
  3225. ÅæåäÀ
  3226. Åæåäß
  3227. /(?<=Z)X./
  3228. \x84XAZXB
  3229. /^(?(2)a|(1)(2))+$/
  3230. 123a
  3231. /(?<=a|bbbb)c/
  3232. ac
  3233. bbbbc
  3234. /line\nbreak/
  3235. this is a line\nbreak
  3236. line one\nthis is a line\nbreak in the second line
  3237. /line\nbreak/firstline
  3238. this is a line\nbreak
  3239. \= Expect no match
  3240. line one\nthis is a line\nbreak in the second line
  3241. /line\nbreak/m,firstline
  3242. this is a line\nbreak
  3243. \= Expect no match
  3244. line one\nthis is a line\nbreak in the second line
  3245. /1234/
  3246. 123\=ps
  3247. \= Expect no match
  3248. a4\=ps,dfa_restart
  3249. /1234/
  3250. 123\=ps
  3251. 4\=ps,dfa_restart
  3252. /^/gm
  3253. a\nb\nc\n
  3254. \
  3255. /(?<=C\n)^/gm
  3256. A\nC\nC\n
  3257. /(?s)A?B/
  3258. AB
  3259. aB
  3260. /(?s)A*B/
  3261. AB
  3262. aB
  3263. /(?m)A?B/
  3264. AB
  3265. aB
  3266. /(?m)A*B/
  3267. AB
  3268. aB
  3269. /Content-Type\x3A[^\r\n]{6,}/
  3270. Content-Type:xxxxxyyy
  3271. /Content-Type\x3A[^\r\n]{6,}z/
  3272. Content-Type:xxxxxyyyz
  3273. /Content-Type\x3A[^a]{6,}/
  3274. Content-Type:xxxyyy
  3275. /Content-Type\x3A[^a]{6,}z/
  3276. Content-Type:xxxyyyz
  3277. /^abc/Im,newline=lf
  3278. xyz\nabc
  3279. xyz\r\nabc
  3280. \= Expect no match
  3281. xyz\rabc
  3282. xyzabc\r
  3283. xyzabc\rpqr
  3284. xyzabc\r\n
  3285. xyzabc\r\npqr
  3286. /^abc/Im,newline=crlf
  3287. xyz\r\nabclf>
  3288. \= Expect no match
  3289. xyz\nabclf
  3290. xyz\rabclf
  3291. /^abc/Im,newline=cr
  3292. xyz\rabc
  3293. \= Expect no match
  3294. xyz\nabc
  3295. xyz\r\nabc
  3296. /.*/I,newline=lf
  3297. abc\ndef
  3298. abc\rdef
  3299. abc\r\ndef
  3300. /.*/I,newline=cr
  3301. abc\ndef
  3302. abc\rdef
  3303. abc\r\ndef
  3304. /.*/I,newline=crlf
  3305. abc\ndef
  3306. abc\rdef
  3307. abc\r\ndef
  3308. /\w+(.)(.)?def/Is
  3309. abc\ndef
  3310. abc\rdef
  3311. abc\r\ndef
  3312. /\w+(.)(.)?def/s
  3313. abc\ndef
  3314. abc\rdef
  3315. abc\r\ndef
  3316. /^\w+=.*(\\\n.*)*/
  3317. abc=xyz\\\npqr
  3318. /^(a()*)*/
  3319. aaaa
  3320. /^(?:a(?:(?:))*)*/
  3321. aaaa
  3322. /^(a()+)+/
  3323. aaaa
  3324. /^(?:a(?:(?:))+)+/
  3325. aaaa
  3326. /(a|)*\d/
  3327. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  3328. \= Expect no match
  3329. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  3330. /(?>a|)*\d/
  3331. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  3332. \= Expect no match
  3333. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  3334. /(?:a|)*\d/
  3335. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  3336. \= Expect no match
  3337. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  3338. /^a.b/newline=lf
  3339. a\rb
  3340. \= Expect no match
  3341. a\nb
  3342. /^a.b/newline=cr
  3343. a\nb
  3344. \= Expect no match
  3345. a\rb
  3346. /^a.b/newline=anycrlf
  3347. a\x85b
  3348. \= Expect no match
  3349. a\rb
  3350. /^a.b/newline=any
  3351. \= Expect no match
  3352. a\nb
  3353. a\rb
  3354. a\x85b
  3355. /^abc./gmx,newline=any
  3356. abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
  3357. /abc.$/gmx,newline=any
  3358. abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
  3359. /^a\Rb/bsr=unicode
  3360. a\nb
  3361. a\rb
  3362. a\r\nb
  3363. a\x0bb
  3364. a\x0cb
  3365. a\x85b
  3366. \= Expect no match
  3367. a\n\rb
  3368. /^a\R*b/bsr=unicode
  3369. ab
  3370. a\nb
  3371. a\rb
  3372. a\r\nb
  3373. a\x0bb
  3374. a\x0cb
  3375. a\x85b
  3376. a\n\rb
  3377. a\n\r\x85\x0cb
  3378. /^a\R+b/bsr=unicode
  3379. a\nb
  3380. a\rb
  3381. a\r\nb
  3382. a\x0bb
  3383. a\x0cb
  3384. a\x85b
  3385. a\n\rb
  3386. a\n\r\x85\x0cb
  3387. \= Expect no match
  3388. ab
  3389. /^a\R{1,3}b/bsr=unicode
  3390. a\nb
  3391. a\n\rb
  3392. a\n\r\x85b
  3393. a\r\n\r\nb
  3394. a\r\n\r\n\r\nb
  3395. a\n\r\n\rb
  3396. a\n\n\r\nb
  3397. \= Expect no match
  3398. a\n\n\n\rb
  3399. a\r
  3400. /.+foo/
  3401. afoo
  3402. \= Expect no match
  3403. \r\nfoo
  3404. \nfoo
  3405. /.+foo/newline=crlf
  3406. afoo
  3407. \nfoo
  3408. \= Expect no match
  3409. \r\nfoo
  3410. /.+foo/newline=any
  3411. afoo
  3412. \= Expect no match
  3413. \nfoo
  3414. \r\nfoo
  3415. /.+foo/s
  3416. afoo
  3417. \r\nfoo
  3418. \nfoo
  3419. /^$/gm,newline=any
  3420. abc\r\rxyz
  3421. abc\n\rxyz
  3422. \= Expect no match
  3423. abc\r\nxyz
  3424. /^X/m
  3425. XABC
  3426. \= Expect no match
  3427. XABC\=notbol
  3428. /(?m)^$/g,newline=any,aftertext
  3429. abc\r\n\r\n
  3430. /(?m)^$|^\r\n/g,newline=any,aftertext
  3431. abc\r\n\r\n
  3432. /(?m)$/g,newline=any,aftertext
  3433. abc\r\n\r\n
  3434. /(?|(abc)|(xyz))/
  3435. >abc<
  3436. >xyz<
  3437. /(x)(?|(abc)|(xyz))(x)/
  3438. xabcx
  3439. xxyzx
  3440. /(x)(?|(abc)(pqr)|(xyz))(x)/
  3441. xabcpqrx
  3442. xxyzx
  3443. /(?|(abc)|(xyz))(?1)/
  3444. abcabc
  3445. xyzabc
  3446. \= Expect no match
  3447. xyzxyz
  3448. /\H\h\V\v/
  3449. X X\x0a
  3450. X\x09X\x0b
  3451. \= Expect no match
  3452. \xa0 X\x0a
  3453. /\H*\h+\V?\v{3,4}/
  3454. \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
  3455. \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
  3456. \x09\x20\xa0\x0a\x0b\x0c
  3457. \= Expect no match
  3458. \x09\x20\xa0\x0a\x0b
  3459. /\H{3,4}/
  3460. XY ABCDE
  3461. XY PQR ST
  3462. /.\h{3,4}./
  3463. XY AB PQRS
  3464. /\h*X\h?\H+Y\H?Z/
  3465. >XNNNYZ
  3466. > X NYQZ
  3467. \= Expect no match
  3468. >XYZ
  3469. > X NY Z
  3470. /\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
  3471. >XY\x0aZ\x0aA\x0bNN\x0c
  3472. >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
  3473. /.+A/newline=crlf
  3474. \= Expect no match
  3475. \r\nA
  3476. /\nA/newline=crlf
  3477. \r\nA
  3478. /[\r\n]A/newline=crlf
  3479. \r\nA
  3480. /(\r|\n)A/newline=crlf
  3481. \r\nA
  3482. /a\Rb/I,bsr=anycrlf
  3483. a\rb
  3484. a\nb
  3485. a\r\nb
  3486. \= Expect no match
  3487. a\x85b
  3488. a\x0bb
  3489. /a\Rb/I,bsr=unicode
  3490. a\rb
  3491. a\nb
  3492. a\r\nb
  3493. a\x85b
  3494. a\x0bb
  3495. /a\R?b/I,bsr=anycrlf
  3496. a\rb
  3497. a\nb
  3498. a\r\nb
  3499. \= Expect no match
  3500. a\x85b
  3501. a\x0bb
  3502. /a\R?b/I,bsr=unicode
  3503. a\rb
  3504. a\nb
  3505. a\r\nb
  3506. a\x85b
  3507. a\x0bb
  3508. /a\R{2,4}b/I,bsr=anycrlf
  3509. a\r\n\nb
  3510. a\n\r\rb
  3511. a\r\n\r\n\r\n\r\nb
  3512. \= Expect no match
  3513. a\x0b\x0bb
  3514. a\x85\x85b
  3515. /a\R{2,4}b/I,bsr=unicode
  3516. a\r\rb
  3517. a\n\n\nb
  3518. a\r\n\n\r\rb
  3519. a\x85\x85b
  3520. a\x0b\x0bb
  3521. \= Expect no match
  3522. a\r\r\r\r\rb
  3523. /a(?!)|\wbc/
  3524. abc
  3525. /a[]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  3526. \= Expect no match
  3527. ab
  3528. /a[]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  3529. \= Expect no match
  3530. ab
  3531. /a[]*+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  3532. \= Expect no match
  3533. ab
  3534. /a[^]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  3535. aXb
  3536. a\nb
  3537. \= Expect no match
  3538. ab
  3539. /a[^]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  3540. aXb
  3541. a\nX\nXb
  3542. \= Expect no match
  3543. ab
  3544. /X$/dollar_endonly
  3545. X
  3546. \= Expect no match
  3547. X\n
  3548. /X$/
  3549. X
  3550. X\n
  3551. /xyz/auto_callout
  3552. xyz
  3553. abcxyz
  3554. \= Expect no match
  3555. abc
  3556. abcxypqr
  3557. /xyz/auto_callout,no_start_optimize
  3558. abcxyz
  3559. \= Expect no match
  3560. abc
  3561. abcxypqr
  3562. /(*NO_START_OPT)xyz/auto_callout
  3563. abcxyz
  3564. /(?C)ab/
  3565. ab
  3566. ab\=callout_none
  3567. /ab/auto_callout
  3568. ab
  3569. ab\=callout_none
  3570. /^"((?(?=[a])[^"])|b)*"$/auto_callout
  3571. "ab"
  3572. "ab"\=callout_none
  3573. /\d+X|9+Y/
  3574. ++++123999\=ps
  3575. ++++123999Y\=ps
  3576. /Z(*F)/
  3577. \= Expect no match
  3578. Z\=ps
  3579. ZA\=ps
  3580. /Z(?!)/
  3581. \= Expect no match
  3582. Z\=ps
  3583. ZA\=ps
  3584. /dog(sbody)?/
  3585. dogs\=ps
  3586. dogs\=ph
  3587. /dog(sbody)??/
  3588. dogs\=ps
  3589. dogs\=ph
  3590. /dog|dogsbody/
  3591. dogs\=ps
  3592. dogs\=ph
  3593. /dogsbody|dog/
  3594. dogs\=ps
  3595. dogs\=ph
  3596. /Z(*F)Q|ZXY/
  3597. Z\=ps
  3598. \= Expect no match
  3599. ZA\=ps
  3600. X\=ps
  3601. /\bthe cat\b/
  3602. the cat\=ps
  3603. the cat\=ph
  3604. /dog(sbody)?/
  3605. dogs\=ps
  3606. body\=dfa_restart
  3607. /dog(sbody)?/
  3608. dogs\=ph
  3609. body\=dfa_restart
  3610. /abc/
  3611. abc\=ps
  3612. abc\=ph
  3613. /abc\K123/
  3614. xyzabc123pqr
  3615. /(?<=abc)123/allusedtext
  3616. xyzabc123pqr
  3617. xyzabc12\=ps
  3618. xyzabc12\=ph
  3619. /\babc\b/allusedtext
  3620. +++abc+++
  3621. +++ab\=ps
  3622. +++ab\=ph
  3623. /(?=C)/g,aftertext
  3624. ABCDECBA
  3625. /(abc|def|xyz)/I
  3626. terhjk;abcdaadsfe
  3627. the quick xyz brown fox
  3628. \= Expect no match
  3629. thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
  3630. /(abc|def|xyz)/I,no_start_optimize
  3631. terhjk;abcdaadsfe
  3632. the quick xyz brown fox
  3633. \= Expect no match
  3634. thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
  3635. /abcd*/aftertext
  3636. xxxxabcd\=ps
  3637. xxxxabcd\=ph
  3638. dddxxx\=dfa_restart
  3639. xxxxabcd\=ph
  3640. xxx\=dfa_restart
  3641. /abcd*/i
  3642. xxxxabcd\=ps
  3643. xxxxabcd\=ph
  3644. XXXXABCD\=ps
  3645. XXXXABCD\=ph
  3646. /abc\d*/
  3647. xxxxabc1\=ps
  3648. xxxxabc1\=ph
  3649. /abc[de]*/
  3650. xxxxabcde\=ps
  3651. xxxxabcde\=ph
  3652. /(?:(?1)|B)(A(*F)|C)/
  3653. ABCD
  3654. CCD
  3655. \= Expect no match
  3656. CAD
  3657. /^(?:(?1)|B)(A(*F)|C)/
  3658. CCD
  3659. BCD
  3660. \= Expect no match
  3661. ABCD
  3662. CAD
  3663. BAD
  3664. /^(?!a(*SKIP)b)/
  3665. ac
  3666. /^(?=a(*SKIP)b|ac)/
  3667. ac
  3668. /^(?=a(*THEN)b|ac)/
  3669. ac
  3670. /^(?=a(*PRUNE)b)/
  3671. ab
  3672. /^(?(?!a(*SKIP)b))/
  3673. ac
  3674. /(?<=abc)def/allusedtext
  3675. abc\=ph
  3676. /abc$/
  3677. abc
  3678. abc\=ps
  3679. abc\=ph
  3680. /abc$/m
  3681. abc
  3682. abc\n
  3683. abc\=ph
  3684. abc\n\=ph
  3685. abc\=ps
  3686. abc\n\=ps
  3687. /abc\z/
  3688. abc
  3689. abc\=ps
  3690. abc\=ph
  3691. /abc\Z/
  3692. abc
  3693. abc\=ps
  3694. abc\=ph
  3695. /abc\b/
  3696. abc
  3697. abc\=ps
  3698. abc\=ph
  3699. /abc\B/
  3700. abc\=ps
  3701. abc\=ph
  3702. \= Expect no match
  3703. abc
  3704. /.+/
  3705. abc\=offset=0
  3706. abc\=offset=1
  3707. abc\=offset=2
  3708. \= Bad offsets
  3709. abc\=offset=4
  3710. abc\=offset=-4
  3711. \= Expect no match
  3712. abc\=offset=3
  3713. /^(?:a)++\w/
  3714. aaaab
  3715. \= Expect no match
  3716. aaaa
  3717. bbb
  3718. /^(?:aa|(?:a)++\w)/
  3719. aaaab
  3720. aaaa
  3721. \= Expect no match
  3722. bbb
  3723. /^(?:a)*+\w/
  3724. aaaab
  3725. bbb
  3726. \= Expect no match
  3727. aaaa
  3728. /^(a)++\w/
  3729. aaaab
  3730. \= Expect no match
  3731. aaaa
  3732. bbb
  3733. /^(a|)++\w/
  3734. aaaab
  3735. \= Expect no match
  3736. aaaa
  3737. bbb
  3738. /(?=abc){3}abc/aftertext
  3739. abcabcabc
  3740. \= Expect no match
  3741. xyz
  3742. /(?=abc)+abc/aftertext
  3743. abcabcabc
  3744. \= Expect no match
  3745. xyz
  3746. /(?=abc)++abc/aftertext
  3747. abcabcabc
  3748. \= Expect no match
  3749. xyz
  3750. /(?=abc){0}xyz/
  3751. xyz
  3752. /(?=abc){1}xyz/
  3753. \= Expect no match
  3754. xyz
  3755. /(?=(a))?./
  3756. ab
  3757. bc
  3758. /(?=(a))??./
  3759. ab
  3760. bc
  3761. /^(?=(a)){0}b(?1)/
  3762. backgammon
  3763. /^(?=(?1))?[az]([abc])d/
  3764. abd
  3765. zcdxx
  3766. /^(?!a){0}\w+/
  3767. aaaaa
  3768. /(?<=(abc))?xyz/
  3769. abcxyz
  3770. pqrxyz
  3771. /((?2))((?1))/
  3772. abc
  3773. /(?(R)a+|(?R)b)/
  3774. aaaabcde
  3775. /(?(R)a+|((?R))b)/
  3776. aaaabcde
  3777. /((?(R)a+|(?1)b))/
  3778. aaaabcde
  3779. /((?(R2)a+|(?1)b))()/
  3780. aaaabcde
  3781. /(?(R)a*(?1)|((?R))b)/
  3782. aaaabcde
  3783. /(a+)/no_auto_possess
  3784. aaaa\=ovector=3
  3785. aaaa\=ovector=4
  3786. /^\R/
  3787. \r\=ps
  3788. \r\=ph
  3789. /^\R{2,3}x/
  3790. \r\=ps
  3791. \r\=ph
  3792. \r\r\=ps
  3793. \r\r\=ph
  3794. \r\r\r\=ps
  3795. \r\r\r\=ph
  3796. \r\rx
  3797. \r\r\rx
  3798. /^\R{2,3}?x/
  3799. \r\=ps
  3800. \r\=ph
  3801. \r\r\=ps
  3802. \r\r\=ph
  3803. \r\r\r\=ps
  3804. \r\r\r\=ph
  3805. \r\rx
  3806. \r\r\rx
  3807. /^\R?x/
  3808. \r\=ps
  3809. \r\=ph
  3810. x
  3811. \rx
  3812. /^\R+x/
  3813. \r\=ps
  3814. \r\=ph
  3815. \r\n\=ps
  3816. \r\n\=ph
  3817. \rx
  3818. /^a$/newline=crlf
  3819. a\r\=ps
  3820. a\r\=ph
  3821. /^a$/m,newline=crlf
  3822. a\r\=ps
  3823. a\r\=ph
  3824. /^(a$|a\r)/newline=crlf
  3825. a\r\=ps
  3826. a\r\=ph
  3827. /^(a$|a\r)/m,newline=crlf
  3828. a\r\=ps
  3829. a\r\=ph
  3830. /./newline=crlf
  3831. \r\=ps
  3832. \r\=ph
  3833. /.{2,3}/newline=crlf
  3834. \r\=ps
  3835. \r\=ph
  3836. \r\r\=ps
  3837. \r\r\=ph
  3838. \r\r\r\=ps
  3839. \r\r\r\=ph
  3840. /.{2,3}?/newline=crlf
  3841. \r\=ps
  3842. \r\=ph
  3843. \r\r\=ps
  3844. \r\r\=ph
  3845. \r\r\r\=ps
  3846. \r\r\r\=ph
  3847. # Test simple validity check for restarts
  3848. /abcdef/
  3849. abc\=dfa_restart
  3850. /<H((?(?!<H|F>)(.)|(?R))++)*F>/
  3851. text <H more text <H texting more hexA0-"\xA0" hex above 7F-"\xBC" F> text xxxxx <H text F> text F> text2 <H text sample F> more text.
  3852. /^(?>.{4})abc|^\w\w.xabcd/
  3853. xxxxabcd
  3854. xx\xa0xabcd
  3855. /^(.{4}){2}+abc|^\w\w.x\w\w\w\wabcd/
  3856. xxxxxxxxabcd
  3857. xx\xa0xxxxxabcd
  3858. /abcd/
  3859. abcd\=ovector=0
  3860. # These tests show up auto-possessification
  3861. /[ab]*/
  3862. aaaa
  3863. /[ab]*?/
  3864. aaaa
  3865. /[ab]?/
  3866. aaaa
  3867. /[ab]??/
  3868. aaaa
  3869. /[ab]+/
  3870. aaaa
  3871. /[ab]+?/
  3872. aaaa
  3873. /[ab]{2,3}/
  3874. aaaa
  3875. /[ab]{2,3}?/
  3876. aaaa
  3877. /[ab]{2,}/
  3878. aaaa
  3879. /[ab]{2,}?/
  3880. aaaa
  3881. '\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++'
  3882. NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
  3883. '\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++'
  3884. NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
  3885. /abc(?=xyz)/allusedtext
  3886. abcxyzpqr
  3887. abcxyzpqr\=aftertext
  3888. /(?<=pqr)abc(?=xyz)/allusedtext
  3889. xyzpqrabcxyzpqr
  3890. xyzpqrabcxyzpqr\=aftertext
  3891. /a\b/
  3892. a.\=allusedtext
  3893. a\=allusedtext
  3894. /abc(?=abcde)(?=ab)/allusedtext
  3895. abcabcdefg
  3896. /a*?b*?/
  3897. ab
  3898. /(*NOTEMPTY)a*?b*?/
  3899. ab
  3900. ba
  3901. cb
  3902. /(*NOTEMPTY_ATSTART)a*?b*?/aftertext
  3903. ab
  3904. cdab
  3905. /(a)(b)|(c)/
  3906. XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
  3907. /(?<A>aa)/
  3908. aa\=get=A
  3909. aa\=copy=A
  3910. /a+/no_auto_possess
  3911. a\=ovector=2,get=1,get=2,getall
  3912. aaa\=ovector=2,get=1,get=2,getall
  3913. /a(b)c(d)/
  3914. abc\=ph,copy=0,copy=1,getall
  3915. /ab(?C" any text with spaces ")cde/B
  3916. abcde
  3917. 12abcde
  3918. /^a(b)c(?C1)def/
  3919. abcdef
  3920. /^a(b)c(?C"AB")def/
  3921. abcdef
  3922. /^a(b)c(?C1)def/
  3923. abcdef\=callout_capture
  3924. /^a(b)c(?C{AB})def/B
  3925. abcdef\=callout_capture
  3926. /^(?(?C25)(?=abc)abcd|xyz)/B
  3927. abcdefg
  3928. xyz123
  3929. /^(?(?C$abc$)(?=abc)abcd|xyz)/B
  3930. abcdefg
  3931. xyz123
  3932. /^ab(?C'first')cd(?C"second")ef/
  3933. abcdefg
  3934. /(?:a(?C`code`)){3}X/
  3935. aaaXY
  3936. # Binary zero in callout string
  3937. /"a(?C'x" 00 "z')b"/hex
  3938. abcdefgh
  3939. /(?(?!)a|b)/
  3940. bbb
  3941. \= Expect no match
  3942. aaa
  3943. /^/gm
  3944. \n\n\n
  3945. /^/gm,alt_circumflex
  3946. \n\n\n
  3947. /abc/use_offset_limit
  3948. 1234abcde\=offset_limit=100
  3949. 1234abcde\=offset_limit=9
  3950. 1234abcde\=offset_limit=4
  3951. 1234abcde\=offset_limit=4,offset=4
  3952. \= Expect no match
  3953. 1234abcde\=offset_limit=4,offset=5
  3954. 1234abcde\=offset_limit=3
  3955. /(?<=abc)/use_offset_limit
  3956. 1234abc\=offset_limit=7
  3957. \= Expect no match
  3958. 1234abc\=offset_limit=6
  3959. /abcd/null_context
  3960. abcd\=null_context
  3961. /()()a+/no_auto_possess
  3962. aaa\=allcaptures
  3963. a\=allcaptures
  3964. /(*LIMIT_DEPTH=100)^((.)(?1)|.)$/
  3965. \= Expect depth limit exceeded
  3966. a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
  3967. /(*LIMIT_HEAP=0)^((.)(?1)|.)$/
  3968. \= Expect heap limit exceeded
  3969. a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
  3970. /(*LIMIT_HEAP=50000)^((.)(?1)|.)$/
  3971. \= Expect success
  3972. a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
  3973. /(02-)?[0-9]{3}-[0-9]{3}/
  3974. 02-123-123
  3975. /^(a(?2))(b)(?1)/
  3976. abbab\=find_limits
  3977. /abc/endanchored
  3978. xyzabc
  3979. \= Expect no match
  3980. xyzabcdef
  3981. \= Expect error
  3982. xyzabc\=ph
  3983. /abc/
  3984. xyzabc\=endanchored
  3985. \= Expect no match
  3986. xyzabcdef\=endanchored
  3987. \= Expect error
  3988. xyzabc\=ps,endanchored
  3989. /abc|bcd/endanchored
  3990. xyzabcd
  3991. \= Expect no match
  3992. xyzabcdef
  3993. /(*NUL)^.*/
  3994. a\nb\x00ccc
  3995. /(*NUL)^.*/s
  3996. a\nb\x00ccc
  3997. /^x/m,newline=nul
  3998. ab\x00xy
  3999. /'#comment' 0d 0a 00 '^x\' 0a 'y'/x,newline=nul,hex
  4000. x\nyz
  4001. /(*NUL)^X\NY/
  4002. X\nY
  4003. X\rY
  4004. \= Expect no match
  4005. X\x00Y
  4006. /(?<=abc|)/
  4007. abcde\=aftertext
  4008. /(?<=|abc)/
  4009. abcde\=aftertext
  4010. /(?<=abc|)/endanchored
  4011. abcde\=aftertext
  4012. /(?<=|abc)/endanchored
  4013. abcde\=aftertext
  4014. /(*LIMIT_MATCH=100).*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00 \x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););/no_dotstar_anchor
  4015. \= Expect limit exceeded
  4016. .*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00 \x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););
  4017. /\n/firstline
  4018. xyz\nabc
  4019. /\nabc/firstline
  4020. xyz\nabc
  4021. /\x{0a}abc/firstline,newline=crlf
  4022. \= Expect no match
  4023. xyz\r\nabc
  4024. /[abc]/firstline
  4025. \= Expect no match
  4026. \na
  4027. /foobar/
  4028. the foobar thing\=copy_matched_subject
  4029. the foobar thing\=copy_matched_subject,zero_terminate
  4030. /foobar/g
  4031. the foobar thing foobar again\=copy_matched_subject
  4032. /(?(VERSION>=0)^B0W)/
  4033. B0W-W0W
  4034. \= Expect no match
  4035. 0
  4036. /(?(VERSION>=1000)^B0W|W0W)/
  4037. B0W-W0W
  4038. \= Expect no match
  4039. 0
  4040. /(?<=pqr)abc(?=xyz)/
  4041. 123pqrabcxy\=ps,allusedtext
  4042. 123pqrabcxyz\=ps,allusedtext
  4043. /(?>a+b)/
  4044. aaaa\=ps
  4045. aaaab\=ps
  4046. /(abc)(?1)/
  4047. abca\=ps
  4048. abcabc\=ps
  4049. /(?(?=abc).*|Z)/
  4050. ab\=ps
  4051. abcxyz\=ps
  4052. /(abc)++x/
  4053. abcab\=ps
  4054. abc\=ps
  4055. ab\=ps
  4056. abcx
  4057. /\z/
  4058. abc\=ph
  4059. abc\=ps
  4060. /\Z/
  4061. abc\=ph
  4062. abc\=ps
  4063. abc\n\=ph
  4064. abc\n\=ps
  4065. /c*+(?<=[bc])/
  4066. abc\=ph
  4067. ab\=ph
  4068. abc\=ps
  4069. ab\=ps
  4070. /c++(?<=[bc])/
  4071. abc\=ph
  4072. ab\=ph
  4073. /(?<=(?=.(?<=x)))/
  4074. abx
  4075. ab\=ph
  4076. bxyz
  4077. xyz
  4078. /(?![ab]).*/
  4079. ab\=ph
  4080. /c*+/
  4081. ab\=ph,offset=2
  4082. /
  4083. /anchored, firstline
  4084. \x0a
  4085. /
  4086. /anchored,firstline,no_start_optimize
  4087. \x0a
  4088. /
  4089. /firstline
  4090. \x0a
  4091. abc\x0adef
  4092. /|a(?0)/endanchored
  4093. aaaa
  4094. # End of testinput6