testinput2 103 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102
  1. # This set of tests is not Perl-compatible. It checks on special features
  2. # of PCRE2's API, error diagnostics, and the compiled code of some patterns.
  3. # It also checks the non-Perl syntax that PCRE2 supports (Python, .NET,
  4. # Oniguruma). There are also some tests where PCRE2 and Perl differ,
  5. # either because PCRE2 can't be compatible, or there is a possible Perl
  6. # bug.
  7. # NOTE: This is a non-UTF set of tests. When UTF support is needed, use
  8. # test 5.
  9. #forbid_utf
  10. #newline_default lf any anycrlf
  11. # Test binary zeroes in the pattern
  12. # /a\0B/ where 0 is a binary zero
  13. /61 5c 00 62/B,hex
  14. a\x{0}b
  15. # /a0b/ where 0 is a binary zero
  16. /61 00 62/B,hex
  17. a\x{0}b
  18. # /(?#B0C)DE/ where 0 is a binary zero
  19. /28 3f 23 42 00 43 29 44 45/B,hex
  20. DE
  21. /(a)b|/I
  22. /abc/I
  23. abc
  24. defabc
  25. abc\=anchored
  26. \= Expect no match
  27. defabc\=anchored
  28. ABC
  29. /^abc/I
  30. abc
  31. abc\=anchored
  32. \= Expect no match
  33. defabc
  34. defabc\=anchored
  35. /a+bc/I
  36. /a*bc/I
  37. /a{3}bc/I
  38. /(abc|a+z)/I
  39. /^abc$/I
  40. abc
  41. \= Expect no match
  42. def\nabc
  43. /ab\idef/
  44. /(?X)ab\idef/
  45. /x{5,4}/
  46. /z{65536}/
  47. /[abcd/
  48. /[\B]/B
  49. /[\R]/B
  50. /[\X]/B
  51. /[z-a]/
  52. /^*/
  53. /(abc/
  54. /(?# abc/
  55. /(?z)abc/
  56. /.*b/I
  57. /.*?b/I
  58. /cat|dog|elephant/I
  59. this sentence eventually mentions a cat
  60. this sentences rambles on and on for a while and then reaches elephant
  61. /cat|dog|elephant/I
  62. this sentence eventually mentions a cat
  63. this sentences rambles on and on for a while and then reaches elephant
  64. /cat|dog|elephant/Ii
  65. this sentence eventually mentions a CAT cat
  66. this sentences rambles on and on for a while to elephant ElePhant
  67. /a|[bcd]/I
  68. /(a|[^\dZ])/I
  69. /(a|b)*[\s]/I
  70. /(ab\2)/
  71. /{4,5}abc/
  72. /(a)(b)(c)\2/I
  73. abcb
  74. abcb\=ovector=0
  75. abcb\=ovector=1
  76. abcb\=ovector=2
  77. abcb\=ovector=3
  78. abcb\=ovector=4
  79. /(a)bc|(a)(b)\2/I
  80. abc
  81. abc\=ovector=0
  82. abc\=ovector=1
  83. abc\=ovector=2
  84. aba
  85. aba\=ovector=0
  86. aba\=ovector=1
  87. aba\=ovector=2
  88. aba\=ovector=3
  89. aba\=ovector=4
  90. /abc$/I,dollar_endonly
  91. abc
  92. \= Expect no match
  93. abc\n
  94. abc\ndef
  95. /(a)(b)(c)(d)(e)\6/
  96. /the quick brown fox/I
  97. the quick brown fox
  98. this is a line with the quick brown fox
  99. /the quick brown fox/I,anchored
  100. the quick brown fox
  101. \= Expect no match
  102. this is a line with the quick brown fox
  103. /ab(?z)cd/
  104. /^abc|def/I
  105. abcdef
  106. abcdef\=notbol
  107. /.*((abc)$|(def))/I
  108. defabc
  109. defabc\=noteol
  110. /)/
  111. /a[]b/
  112. /[^aeiou ]{3,}/I
  113. co-processors, and for
  114. /<.*>/I
  115. abc<def>ghi<klm>nop
  116. /<.*?>/I
  117. abc<def>ghi<klm>nop
  118. /<.*>/I,ungreedy
  119. abc<def>ghi<klm>nop
  120. /(?U)<.*>/I
  121. abc<def>ghi<klm>nop
  122. /<.*?>/I,ungreedy
  123. abc<def>ghi<klm>nop
  124. /={3,}/I,ungreedy
  125. abc========def
  126. /(?U)={3,}?/I
  127. abc========def
  128. /(?<!bar|cattle)foo/I
  129. foo
  130. catfoo
  131. \= Expect no match
  132. the barfoo
  133. and cattlefoo
  134. /abc(?<=a+)b/
  135. /(?<!(foo)a\1)bar/
  136. /(?i)abc/I
  137. /(a|(?m)a)/I
  138. /(?i)^1234/I
  139. /(^b|(?i)^d)/I
  140. /(?s).*/I
  141. /[abcd]/I
  142. /(?i)[abcd]/I
  143. /(?m)[xy]|(b|c)/I
  144. /(^a|^b)/Im
  145. /(?i)(^a|^b)/Im
  146. /(a)(?(1)a|b|c)/
  147. /(?(?=a)a|b|c)/
  148. /(?(1a)/
  149. /(?(1a))/
  150. /(?(?i))/
  151. /(?(abc))/
  152. /(?(?<ab))/
  153. /((?s)blah)\s+\1/I
  154. /((?i)blah)\s+\1/I
  155. /((?i)b)/IB
  156. /(a*b|(?i:c*(?-i)d))/I
  157. /a$/I
  158. a
  159. a\n
  160. \= Expect no match
  161. a\=noteol
  162. a\n\=noteol
  163. /a$/Im
  164. a
  165. a\n
  166. a\n\=noteol
  167. \= Expect no match
  168. a\=noteol
  169. /\Aabc/Im
  170. /^abc/Im
  171. /^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/I
  172. aaaaabbbbbcccccdef
  173. /(?<=foo)[ab]/I
  174. /(?<!foo)(alpha|omega)/I
  175. /(?!alphabet)[ab]/I
  176. /(?<=foo\n)^bar/Im
  177. foo\nbarbar
  178. \= Expect no match
  179. rhubarb
  180. barbell
  181. abc\nbarton
  182. /^(?<=foo\n)bar/Im
  183. foo\nbarbar
  184. \= Expect no match
  185. rhubarb
  186. barbell
  187. abc\nbarton
  188. /(?>^abc)/Im
  189. abc
  190. def\nabc
  191. \= Expect no match
  192. defabc
  193. /(?<=ab(c+)d)ef/
  194. /(?<=ab(?<=c+)d)ef/
  195. /The next three are in testinput2 because they have variable length branches/
  196. /(?<=bullock|donkey)-cart/I
  197. the bullock-cart
  198. a donkey-cart race
  199. \= Expect no match
  200. cart
  201. horse-and-cart
  202. /(?<=ab(?i)x|y|z)/I
  203. /(?>.*)(?<=(abcd)|(xyz))/I
  204. alphabetabcd
  205. endingxyz
  206. /(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/I
  207. abxyZZ
  208. abXyZZ
  209. ZZZ
  210. zZZ
  211. bZZ
  212. BZZ
  213. \= Expect no match
  214. ZZ
  215. abXYZZ
  216. zzz
  217. bzz
  218. /(?<!(foo)a)bar/I
  219. bar
  220. foobbar
  221. \= Expect no match
  222. fooabar
  223. # Perl does not fail these two for the final subjects.
  224. /^(xa|=?\1a){2}$/
  225. xa=xaa
  226. \= Expect no match
  227. xa=xaaa
  228. /^(xa|=?\1a)+$/
  229. xa=xaa
  230. \= Expect no match
  231. xa=xaaa
  232. # These are syntax tests from Perl 5.005
  233. /a[b-a]/
  234. /a[]b/
  235. /a[/
  236. /*a/
  237. /(*)b/
  238. /abc)/
  239. /(abc/
  240. /a**/
  241. /)(/
  242. /\1/
  243. /\2/
  244. /(a)|\2/
  245. /a[b-a]/Ii
  246. /a[]b/Ii
  247. /a[/Ii
  248. /*a/Ii
  249. /(*)b/Ii
  250. /abc)/Ii
  251. /(abc/Ii
  252. /a**/Ii
  253. /)(/Ii
  254. /:(?:/
  255. /(?<%)b/
  256. /a(?{)b/
  257. /a(?{{})b/
  258. /a(?{}})b/
  259. /a(?{"{"})b/
  260. /a(?{"{"}})b/
  261. /(?(1?)a|b)/
  262. /[a[:xyz:/
  263. /(?<=x+)y/
  264. /a{37,17}/
  265. /abc/\
  266. /abc/\i
  267. /(a)bc(d)/I
  268. abcd
  269. abcd\=copy=2
  270. abcd\=copy=5
  271. /(.{20})/I
  272. abcdefghijklmnopqrstuvwxyz
  273. abcdefghijklmnopqrstuvwxyz\=copy=1
  274. abcdefghijklmnopqrstuvwxyz\=get=1
  275. /(.{15})/I
  276. abcdefghijklmnopqrstuvwxyz
  277. abcdefghijklmnopqrstuvwxyz\=copy=1,get=1
  278. /(.{16})/I
  279. abcdefghijklmnopqrstuvwxyz
  280. abcdefghijklmnopqrstuvwxyz\=copy=1,get=1,getall
  281. /^(a|(bc))de(f)/I
  282. adef\=get=1,get=2,get=3,get=4,getall
  283. bcdef\=get=1,get=2,get=3,get=4,getall
  284. adefghijk\=copy=0
  285. /^abc\00def/I
  286. abc\00def\=copy=0,getall
  287. /word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
  288. )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
  289. )?)?)?)?)?)?)?)?)?otherword/I
  290. /.*X/IB
  291. /.*X/IBs
  292. /(.*X|^B)/IB
  293. /(.*X|^B)/IBs
  294. /(?s)(.*X|^B)/IB
  295. /(?s:.*X|^B)/IB
  296. /\Biss\B/I,aftertext
  297. Mississippi
  298. /iss/I,aftertext,altglobal
  299. Mississippi
  300. /\Biss\B/I,aftertext,altglobal
  301. Mississippi
  302. /\Biss\B/Ig,aftertext
  303. Mississippi
  304. \= Expect no match
  305. Mississippi\=anchored
  306. /(?<=[Ms])iss/Ig,aftertext
  307. Mississippi
  308. /(?<=[Ms])iss/I,aftertext,altglobal
  309. Mississippi
  310. /^iss/Ig,aftertext
  311. ississippi
  312. /.*iss/Ig,aftertext
  313. abciss\nxyzisspqr
  314. /.i./Ig,aftertext
  315. Mississippi
  316. Mississippi\=anchored
  317. Missouri river
  318. Missouri river\=anchored
  319. /^.is/Ig,aftertext
  320. Mississippi
  321. /^ab\n/Ig,aftertext
  322. ab\nab\ncd
  323. /^ab\n/Igm,aftertext
  324. ab\nab\ncd
  325. /^/gm,newline=any
  326. a\rb\nc\r\nxyz\=aftertext
  327. /abc/I
  328. /abc|bac/I
  329. /(abc|bac)/I
  330. /(abc|(c|dc))/I
  331. /(abc|(d|de)c)/I
  332. /a*/I
  333. /a+/I
  334. /(baa|a+)/I
  335. /a{0,3}/I
  336. /baa{3,}/I
  337. /"([^\\"]+|\\.)*"/I
  338. /(abc|ab[cd])/I
  339. /(a|.)/I
  340. /a|ba|\w/I
  341. /abc(?=pqr)/I
  342. /...(?<=abc)/I
  343. /abc(?!pqr)/I
  344. /ab./I
  345. /ab[xyz]/I
  346. /abc*/I
  347. /ab.c*/I
  348. /a.c*/I
  349. /.c*/I
  350. /ac*/I
  351. /(a.c*|b.c*)/I
  352. /a.c*|aba/I
  353. /.+a/I
  354. /(?=abcda)a.*/I
  355. /(?=a)a.*/I
  356. /a(b)*/I
  357. /a\d*/I
  358. /ab\d*/I
  359. /a(\d)*/I
  360. /abcde{0,0}/I
  361. /ab\d+/I
  362. /a(?(1)b)(.)/I
  363. /a(?(1)bag|big)(.)/I
  364. /a(?(1)bag|big)*(.)/I
  365. /a(?(1)bag|big)+(.)/I
  366. /a(?(1)b..|b..)(.)/I
  367. /ab\d{0}e/I
  368. /a?b?/I
  369. a
  370. b
  371. ab
  372. \
  373. \= Expect no match
  374. \=notempty
  375. /|-/I
  376. abcd
  377. -abc
  378. ab-c\=notempty
  379. \= Expect no match
  380. abc\=notempty
  381. /^.?abcd/I
  382. /\( # ( at start
  383. (?: # Non-capturing bracket
  384. (?>[^()]+) # Either a sequence of non-brackets (no backtracking)
  385. | # Or
  386. (?R) # Recurse - i.e. nested bracketed string
  387. )* # Zero or more contents
  388. \) # Closing )
  389. /Ix
  390. (abcd)
  391. (abcd)xyz
  392. xyz(abcd)
  393. (ab(xy)cd)pqr
  394. (ab(xycd)pqr
  395. () abc ()
  396. 12(abcde(fsh)xyz(foo(bar))lmno)89
  397. \= Expect no match
  398. abcd
  399. abcd)
  400. (abcd
  401. /\( ( (?>[^()]+) | (?R) )* \) /Igx
  402. (ab(xy)cd)pqr
  403. 1(abcd)(x(y)z)pqr
  404. /\( (?: (?>[^()]+) | (?R) ) \) /Ix
  405. (abcd)
  406. (ab(xy)cd)
  407. (a(b(c)d)e)
  408. ((ab))
  409. \= Expect no match
  410. ()
  411. /\( (?: (?>[^()]+) | (?R) )? \) /Ix
  412. ()
  413. 12(abcde(fsh)xyz(foo(bar))lmno)89
  414. /\( ( (?>[^()]+) | (?R) )* \) /Ix
  415. (ab(xy)cd)
  416. /\( ( ( (?>[^()]+) | (?R) )* ) \) /Ix
  417. (ab(xy)cd)
  418. /\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /Ix
  419. (ab(xy)cd)
  420. (123ab(xy)cd)
  421. /\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /Ix
  422. (ab(xy)cd)
  423. (123ab(xy)cd)
  424. /\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /Ix
  425. (ab(xy)cd)
  426. /\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /Ix
  427. (abcd(xyz<p>qrs)123)
  428. /\( ( ( (?>[^()]+) | ((?R)) )* ) \) /Ix
  429. (ab(cd)ef)
  430. (ab(cd(ef)gh)ij)
  431. /^[[:alnum:]]/IB
  432. /^[[:^alnum:]]/IB
  433. /^[[:alpha:]]/IB
  434. /^[[:^alpha:]]/IB
  435. /[_[:alpha:]]/I
  436. /^[[:ascii:]]/IB
  437. /^[[:^ascii:]]/IB
  438. /^[[:blank:]]/IB
  439. /^[[:^blank:]]/IB
  440. /[\n\x0b\x0c\x0d[:blank:]]/I
  441. /^[[:cntrl:]]/IB
  442. /^[[:digit:]]/IB
  443. /^[[:graph:]]/IB
  444. /^[[:lower:]]/IB
  445. /^[[:print:]]/IB
  446. /^[[:punct:]]/IB
  447. /^[[:space:]]/IB
  448. /^[[:upper:]]/IB
  449. /^[[:xdigit:]]/IB
  450. /^[[:word:]]/IB
  451. /^[[:^cntrl:]]/IB
  452. /^[12[:^digit:]]/IB
  453. /^[[:^blank:]]/IB
  454. /[01[:alpha:]%]/IB
  455. /[[.ch.]]/I
  456. /[[=ch=]]/I
  457. /[[:rhubarb:]]/I
  458. /[[:upper:]]/Ii
  459. A
  460. a
  461. /[[:lower:]]/Ii
  462. A
  463. a
  464. /((?-i)[[:lower:]])[[:lower:]]/Ii
  465. ab
  466. aB
  467. \= Expect no match
  468. Ab
  469. AB
  470. /[\200-\110]/I
  471. /^(?(0)f|b)oo/I
  472. # This one's here because of the large output vector needed
  473. /(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/I
  474. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 ABC ABC\=ovector=300
  475. # This one's here because Perl does this differently and PCRE2 can't at present
  476. /(main(O)?)+/I
  477. mainmain
  478. mainOmain
  479. # These are all cases where Perl does it differently (nested captures)
  480. /^(a(b)?)+$/I
  481. aba
  482. /^(aa(bb)?)+$/I
  483. aabbaa
  484. /^(aa|aa(bb))+$/I
  485. aabbaa
  486. /^(aa(bb)??)+$/I
  487. aabbaa
  488. /^(?:aa(bb)?)+$/I
  489. aabbaa
  490. /^(aa(b(b))?)+$/I
  491. aabbaa
  492. /^(?:aa(b(b))?)+$/I
  493. aabbaa
  494. /^(?:aa(b(?:b))?)+$/I
  495. aabbaa
  496. /^(?:aa(bb(?:b))?)+$/I
  497. aabbbaa
  498. /^(?:aa(b(?:bb))?)+$/I
  499. aabbbaa
  500. /^(?:aa(?:b(b))?)+$/I
  501. aabbaa
  502. /^(?:aa(?:b(bb))?)+$/I
  503. aabbbaa
  504. /^(aa(b(bb))?)+$/I
  505. aabbbaa
  506. /^(aa(bb(bb))?)+$/I
  507. aabbbbaa
  508. # ----------------
  509. /#/IBx
  510. /a#/IBx
  511. /[\s]/IB
  512. /[\S]/IB
  513. /a(?i)b/IB
  514. ab
  515. aB
  516. \= Expect no match
  517. AB
  518. /(a(?i)b)/IB
  519. ab
  520. aB
  521. \= Expect no match
  522. AB
  523. / (?i)abc/IBx
  524. /#this is a comment
  525. (?i)abc/IBx
  526. /123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/IB
  527. /\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/IB
  528. /\Q\E/IB
  529. \
  530. /\Q\Ex/IB
  531. / \Q\E/IB
  532. /a\Q\E/IB
  533. abc
  534. bca
  535. bac
  536. /a\Q\Eb/IB
  537. abc
  538. /\Q\Eabc/IB
  539. /x*+\w/IB
  540. \= Expect no match
  541. xxxxx
  542. /x?+/IB
  543. /x++/IB
  544. /x{1,3}+/B,no_auto_possess
  545. /x{1,3}+/Bi,no_auto_possess
  546. /[^x]{1,3}+/B,no_auto_possess
  547. /[^x]{1,3}+/Bi,no_auto_possess
  548. /(x)*+/IB
  549. /^(\w++|\s++)*$/I
  550. now is the time for all good men to come to the aid of the party
  551. \= Expect no match
  552. this is not a line with only words and spaces!
  553. /(\d++)(\w)/I
  554. 12345a
  555. \= Expect no match
  556. 12345+
  557. /a++b/I
  558. aaab
  559. /(a++b)/I
  560. aaab
  561. /(a++)b/I
  562. aaab
  563. /([^()]++|\([^()]*\))+/I
  564. ((abc(ade)ufh()()x
  565. /\(([^()]++|\([^()]+\))+\)/I
  566. (abc)
  567. (abc(def)xyz)
  568. \= Expect no match
  569. ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  570. /(abc){1,3}+/IB
  571. /a+?+/I
  572. /a{2,3}?+b/I
  573. /(?U)a+?+/I
  574. /a{2,3}?+b/I,ungreedy
  575. /x(?U)a++b/IB
  576. xaaaab
  577. /(?U)xa++b/IB
  578. xaaaab
  579. /^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/IB
  580. /^x(?U)a+b/IB
  581. /^x(?U)(a+)b/IB
  582. /[.x.]/I
  583. /[=x=]/I
  584. /[:x:]/I
  585. /\F/I
  586. /\l/I
  587. /\L/I
  588. /\N{name}/I
  589. /\u/I
  590. /\U/I
  591. /\N{4}/
  592. abcdefg
  593. /\N{,}/
  594. /\N{25,ab}/
  595. /a{1,3}b/ungreedy
  596. ab
  597. /[/I
  598. /[a-/I
  599. /[[:space:]/I
  600. /[\s]/IB
  601. /[[:space:]]/IB
  602. /[[:space:]abcde]/IB
  603. /< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/Ix
  604. <>
  605. <abcd>
  606. <abc <123> hij>
  607. <abc <def> hij>
  608. <abc<>def>
  609. <abc<>
  610. \= Expect no match
  611. <abc
  612. /8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b/IB
  613. /\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b/IB
  614. /(.*)\d+\1/I
  615. /(.*)\d+/I
  616. /(.*)\d+\1/Is
  617. /(.*)\d+/Is
  618. /(.*(xyz))\d+\2/I
  619. /((.*))\d+\1/I
  620. abc123bc
  621. /a[b]/I
  622. /(?=a).*/I
  623. /(?=abc).xyz/Ii
  624. /(?=abc)(?i).xyz/I
  625. /(?=a)(?=b)/I
  626. /(?=.)a/I
  627. /((?=abcda)a)/I
  628. /((?=abcda)ab)/I
  629. /()a/I
  630. /(?:(?=.)|(?<!x))a/I
  631. /(?(1)ab|ac)(.)/I
  632. /(?(1)abz|acz)(.)/I
  633. /(?(1)abz)(.)/I
  634. /(?(1)abz)(1)23/I
  635. /(a)+/I
  636. /(a){2,3}/I
  637. /(a)*/I
  638. /[a]/I
  639. /[ab]/I
  640. /[ab]/I
  641. /[^a]/I
  642. /\d456/I
  643. /\d456/I
  644. /a^b/I
  645. /^a/Im
  646. abcde
  647. xy\nabc
  648. \= Expect no match
  649. xyabc
  650. /c|abc/I
  651. /(?i)[ab]/I
  652. /[ab](?i)cd/I
  653. /abc(?C)def/I
  654. abcdef
  655. 1234abcdef
  656. \= Expect no match
  657. abcxyz
  658. abcxyzf
  659. /abc(?C)de(?C1)f/I
  660. 123abcdef
  661. /(?C1)\dabc(?C2)def/I
  662. 1234abcdef
  663. \= Expect no match
  664. abcdef
  665. /(?C1)\dabc(?C2)def/I
  666. 1234abcdef
  667. \= Expect no match
  668. abcdef
  669. /(?C255)ab/I
  670. /(?C256)ab/I
  671. /(?Cab)xx/I
  672. /(?C12vr)x/I
  673. /abc(?C)def/I
  674. \x83\x0\x61bcdef
  675. /(abc)(?C)de(?C1)f/I
  676. 123abcdef
  677. 123abcdef\=callout_capture
  678. 123abcdefC-\=callout_none
  679. \= Expect no match
  680. 123abcdef\=callout_fail=1
  681. /(?C0)(abc(?C1))*/I
  682. abcabcabc
  683. abcabc\=callout_fail=1:4
  684. abcabcabc\=callout_fail=1:4
  685. /(\d{3}(?C))*/I
  686. 123\=callout_capture
  687. 123456\=callout_capture
  688. 123456789\=callout_capture
  689. /((xyz)(?C)p|(?C1)xyzabc)/I
  690. xyzabc\=callout_capture
  691. /(X)((xyz)(?C)p|(?C1)xyzabc)/I
  692. Xxyzabc\=callout_capture
  693. /(?=(abc))(?C)abcdef/I
  694. abcdef\=callout_capture
  695. /(?!(abc)(?C1)d)(?C2)abcxyz/I
  696. abcxyz\=callout_capture
  697. /(?<=(abc)(?C))xyz/I
  698. abcxyz\=callout_capture
  699. /a(b+)(c*)(?C1)/I
  700. \= Expect no match
  701. abbbbbccc\=callout_data=1
  702. /a(b+?)(c*?)(?C1)/I
  703. \= Expect no match
  704. abbbbbccc\=callout_data=1
  705. /(?C)abc/I
  706. /(?C)^abc/I
  707. /(?C)a|b/I
  708. /a|(b)(?C)/I
  709. b
  710. /x(ab|(bc|(de|(?R))))/I
  711. xab
  712. xbc
  713. xde
  714. xxab
  715. xxxab
  716. \= Expect no match
  717. xyab
  718. /^([^()]|\((?1)*\))*$/I
  719. abc
  720. a(b)c
  721. a(b(c))d
  722. \= Expect no match)
  723. a(b(c)d
  724. /^>abc>([^()]|\((?1)*\))*<xyz<$/I
  725. >abc>123<xyz<
  726. >abc>1(2)3<xyz<
  727. >abc>(1(2)3)<xyz<
  728. /(a(?1)b)/IB
  729. /(a(?1)+b)/IB
  730. /^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/I
  731. 12
  732. (((2+2)*-3)-7)
  733. -12
  734. \= Expect no match
  735. ((2+2)*-3)-7)
  736. /^(x(y|(?1){2})z)/I
  737. xyz
  738. xxyzxyzz
  739. \= Expect no match
  740. xxyzz
  741. xxyzxyzxyzz
  742. /((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/Ix
  743. <>
  744. <abcd>
  745. <abc <123> hij>
  746. <abc <def> hij>
  747. <abc<>def>
  748. <abc<>
  749. \= Expect no match
  750. <abc
  751. /(?1)/I
  752. /((?2)(abc)/I
  753. /^(abc)def(?1)/I
  754. abcdefabc
  755. /^(a|b|c)=(?1)+/I
  756. a=a
  757. a=b
  758. a=bc
  759. /^(a|b|c)=((?1))+/I
  760. a=a
  761. a=b
  762. a=bc
  763. /a(?P<name1>b|c)d(?P<longername2>e)/IB
  764. abde
  765. acde
  766. /(?:a(?P<c>c(?P<d>d)))(?P<a>a)/IB
  767. /(?P<a>a)...(?P=a)bbb(?P>a)d/IB
  768. /^\W*(?:(?P<one>(?P<two>.)\W*(?P>one)\W*(?P=two)|)|(?P<three>(?P<four>.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/Ii
  769. 1221
  770. Satan, oscillate my metallic sonatas!
  771. A man, a plan, a canal: Panama!
  772. Able was I ere I saw Elba.
  773. \= Expect no match
  774. The quick brown fox
  775. /((?(R)a|b))\1(?1)?/I
  776. bb
  777. bbaa
  778. /(.*)a/Is
  779. /(.*)a\1/Is
  780. /(.*)a(b)\2/Is
  781. /((.*)a|(.*)b)z/Is
  782. /((.*)a|(.*)b)z\1/Is
  783. /((.*)a|(.*)b)z\2/Is
  784. /((.*)a|(.*)b)z\3/Is
  785. /((.*)a|^(.*)b)z\3/Is
  786. /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/Is
  787. /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/Is
  788. /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/Is
  789. /(a)(bc)/IB,no_auto_capture
  790. abc
  791. /(?P<one>a)(bc)/IB,no_auto_capture
  792. abc
  793. /(a)(?P<named>bc)/IB,no_auto_capture
  794. /(aaa(?C1)bbb|ab)/I
  795. aaabbb
  796. aaabbb\=callout_data=0
  797. aaabbb\=callout_data=1
  798. \= Expect no match
  799. aaabbb\=callout_data=-1
  800. /ab(?P<one>cd)ef(?P<two>gh)/I
  801. abcdefgh
  802. abcdefgh\=copy=1,get=two
  803. abcdefgh\=copy=one,copy=two
  804. abcdefgh\=copy=three
  805. /(?P<Tes>)(?P<Test>)/IB
  806. /(?P<Test>)(?P<Tes>)/IB
  807. /(?P<Z>zz)(?P<A>aa)/I
  808. zzaa\=copy=Z
  809. zzaa\=copy=A
  810. /(?P<x>eks)(?P<x>eccs)/I
  811. /(?P<abc>abc(?P<def>def)(?P<abc>xyz))/I
  812. "\[((?P<elem>\d+)(,(?P>elem))*)\]"I
  813. [10,20,30,5,5,4,4,2,43,23,4234]
  814. \= Expect no match
  815. []
  816. "\[((?P<elem>\d+)(,(?P>elem))*)?\]"I
  817. [10,20,30,5,5,4,4,2,43,23,4234]
  818. []
  819. /(a(b(?2)c))?/IB
  820. /(a(b(?2)c))*/IB
  821. /(a(b(?2)c)){0,2}/IB
  822. /[ab]{1}+/B
  823. /()(?1){1}/B
  824. /()(?1)/B
  825. /((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
  826. Baby Bjorn Active Carrier - With free SHIPPING!!
  827. /((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
  828. Baby Bjorn Active Carrier - With free SHIPPING!!
  829. /a*.*b/IB
  830. /(a|b)*.?c/IB
  831. /abc(?C255)de(?C)f/IB
  832. /abcde/IB,auto_callout
  833. abcde
  834. \= Expect no match
  835. abcdfe
  836. /a*b/IB,auto_callout
  837. ab
  838. aaaab
  839. aaaacb
  840. /a*b/IB,auto_callout
  841. ab
  842. aaaab
  843. aaaacb
  844. /a+b/IB,auto_callout
  845. ab
  846. aaaab
  847. \= Expect no match
  848. aaaacb
  849. /(abc|def)x/IB,auto_callout
  850. abcx
  851. defx
  852. \= Expect no match
  853. abcdefzx
  854. /(abc|def)x/IB,auto_callout
  855. abcx
  856. defx
  857. \= Expect no match
  858. abcdefzx
  859. /(ab|cd){3,4}/I,auto_callout
  860. ababab
  861. abcdabcd
  862. abcdcdcdcdcd
  863. /([ab]{,}c|xy)/IB,auto_callout
  864. \= Expect no match
  865. Note: that {,} does NOT introduce a quantifier
  866. /([ab]{,}c|xy)/IB,auto_callout
  867. \= Expect no match
  868. Note: that {,} does NOT introduce a quantifier
  869. /([ab]{1,4}c|xy){4,5}?123/IB,auto_callout
  870. aacaacaacaacaac123
  871. /\b.*/I
  872. ab cd\=offset=1
  873. /\b.*/Is
  874. ab cd\=startoffset=1
  875. /(?!.bcd).*/I
  876. Xbcd12345
  877. /abcde/I
  878. ab\=ps
  879. abc\=ps
  880. abcd\=ps
  881. abcde\=ps
  882. the quick brown abc\=ps
  883. \= Expect no match\=ps
  884. the quick brown abxyz fox\=ps
  885. "^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"I
  886. 13/05/04\=ps
  887. 13/5/2004\=ps
  888. 02/05/09\=ps
  889. 1\=ps
  890. 1/2\=ps
  891. 1/2/0\=ps
  892. 1/2/04\=ps
  893. 0\=ps
  894. 02/\=ps
  895. 02/0\=ps
  896. 02/1\=ps
  897. \= Expect no match\=ps
  898. \=ps
  899. 123\=ps
  900. 33/4/04\=ps
  901. 3/13/04\=ps
  902. 0/1/2003\=ps
  903. 0/\=ps
  904. 02/0/\=ps
  905. 02/13\=ps
  906. /0{0,2}ABC/I
  907. /\d{3,}ABC/I
  908. /\d*ABC/I
  909. /[abc]+DE/I
  910. /[abc]?123/I
  911. 123\=ps
  912. a\=ps
  913. b\=ps
  914. c\=ps
  915. c12\=ps
  916. c123\=ps
  917. /^(?:\d){3,5}X/I
  918. 1\=ps
  919. 123\=ps
  920. 123X
  921. 1234\=ps
  922. 1234X
  923. 12345\=ps
  924. 12345X
  925. \= Expect no match
  926. 1X
  927. 123456\=ps
  928. "<(\w+)/?>(.)*</(\1)>"Igms
  929. <!DOCTYPE seite SYSTEM "http://www.lco.lineas.de/xmlCms.dtd">\n<seite>\n<dokumenteninformation>\n<seitentitel>Partner der LCO</seitentitel>\n<sprache>de</sprache>\n<seitenbeschreibung>Partner der LINEAS Consulting\nGmbH</seitenbeschreibung>\n<schluesselworte>LINEAS Consulting GmbH Hamburg\nPartnerfirmen</schluesselworte>\n<revisit>30 days</revisit>\n<robots>index,follow</robots>\n<menueinformation>\n<aktiv>ja</aktiv>\n<menueposition>3</menueposition>\n<menuetext>Partner</menuetext>\n</menueinformation>\n<lastedited>\n<autor>LCO</autor>\n<firma>LINEAS Consulting</firma>\n<datum>15.10.2003</datum>\n</lastedited>\n</dokumenteninformation>\n<inhalt>\n\n<absatzueberschrift>Die Partnerfirmen der LINEAS Consulting\nGmbH</absatzueberschrift>\n\n<absatz><link ziel="http://www.ca.com/" zielfenster="_blank">\n<bild name="logo_ca.gif" rahmen="no"/></link> <link\nziel="http://www.ey.com/" zielfenster="_blank"><bild\nname="logo_euy.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.cisco.de/" zielfenster="_blank">\n<bild name="logo_cisco.gif" rahmen="ja"/></link></absatz>\n\n<absatz><link ziel="http://www.atelion.de/"\nzielfenster="_blank"><bild\nname="logo_atelion.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.line-information.de/"\nzielfenster="_blank">\n<bild name="logo_line_information.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><bild name="logo_aw.gif" rahmen="no"/></absatz>\n\n<absatz><link ziel="http://www.incognis.de/"\nzielfenster="_blank"><bild\nname="logo_incognis.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.addcraft.com/"\nzielfenster="_blank"><bild\nname="logo_addcraft.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.comendo.com/"\nzielfenster="_blank"><bild\nname="logo_comendo.gif" rahmen="no"/></link></absatz>\n\n</inhalt>\n</seite>\=jitstack=1024
  930. /line\nbreak/I
  931. this is a line\nbreak
  932. line one\nthis is a line\nbreak in the second line
  933. /line\nbreak/I,firstline
  934. this is a line\nbreak
  935. \= Expect no match
  936. line one\nthis is a line\nbreak in the second line
  937. /line\nbreak/Im,firstline
  938. this is a line\nbreak
  939. \= Expect no match
  940. line one\nthis is a line\nbreak in the second line
  941. /(?i)(?-i)AbCd/I
  942. AbCd
  943. \= Expect no match
  944. abcd
  945. /a{11111111111111111111}/I
  946. /(){64294967295}/I
  947. /(){2,4294967295}/I
  948. "(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"I
  949. abcdefghijklAkB
  950. "(?P<n0>a)(?P<n1>b)(?P<n2>c)(?P<n3>d)(?P<n4>e)(?P<n5>f)(?P<n6>g)(?P<n7>h)(?P<n8>i)(?P<n9>j)(?P<n10>k)(?P<n11>l)A\11B"I
  951. abcdefghijklAkB
  952. "(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"I
  953. abcdefghijklAkB
  954. "(?P<name0>a)(?P<name1>a)(?P<name2>a)(?P<name3>a)(?P<name4>a)(?P<name5>a)(?P<name6>a)(?P<name7>a)(?P<name8>a)(?P<name9>a)(?P<name10>a)(?P<name11>a)(?P<name12>a)(?P<name13>a)(?P<name14>a)(?P<name15>a)(?P<name16>a)(?P<name17>a)(?P<name18>a)(?P<name19>a)(?P<name20>a)(?P<name21>a)(?P<name22>a)(?P<name23>a)(?P<name24>a)(?P<name25>a)(?P<name26>a)(?P<name27>a)(?P<name28>a)(?P<name29>a)(?P<name30>a)(?P<name31>a)(?P<name32>a)(?P<name33>a)(?P<name34>a)(?P<name35>a)(?P<name36>a)(?P<name37>a)(?P<name38>a)(?P<name39>a)(?P<name40>a)(?P<name41>a)(?P<name42>a)(?P<name43>a)(?P<name44>a)(?P<name45>a)(?P<name46>a)(?P<name47>a)(?P<name48>a)(?P<name49>a)(?P<name50>a)(?P<name51>a)(?P<name52>a)(?P<name53>a)(?P<name54>a)(?P<name55>a)(?P<name56>a)(?P<name57>a)(?P<name58>a)(?P<name59>a)(?P<name60>a)(?P<name61>a)(?P<name62>a)(?P<name63>a)(?P<name64>a)(?P<name65>a)(?P<name66>a)(?P<name67>a)(?P<name68>a)(?P<name69>a)(?P<name70>a)(?P<name71>a)(?P<name72>a)(?P<name73>a)(?P<name74>a)(?P<name75>a)(?P<name76>a)(?P<name77>a)(?P<name78>a)(?P<name79>a)(?P<name80>a)(?P<name81>a)(?P<name82>a)(?P<name83>a)(?P<name84>a)(?P<name85>a)(?P<name86>a)(?P<name87>a)(?P<name88>a)(?P<name89>a)(?P<name90>a)(?P<name91>a)(?P<name92>a)(?P<name93>a)(?P<name94>a)(?P<name95>a)(?P<name96>a)(?P<name97>a)(?P<name98>a)(?P<name99>a)(?P<name100>a)"I
  955. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  956. "(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)"I
  957. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  958. /[^()]*(?:\((?R)\)[^()]*)*/I
  959. (this(and)that
  960. (this(and)that)
  961. (this(and)that)stuff
  962. /[^()]*(?:\((?>(?R))\)[^()]*)*/I
  963. (this(and)that
  964. (this(and)that)
  965. /[^()]*(?:\((?R)\))*[^()]*/I
  966. (this(and)that
  967. (this(and)that)
  968. /(?:\((?R)\))*[^()]*/I
  969. (this(and)that
  970. (this(and)that)
  971. ((this))
  972. /(?:\((?R)\))|[^()]*/I
  973. (this(and)that
  974. (this(and)that)
  975. (this)
  976. ((this))
  977. /\x{0000ff}/I
  978. /^((?P<A>a1)|(?P<A>a2)b)/I
  979. /^((?P<A>a1)|(?P<A>a2)b)/I,dupnames
  980. a1b\=copy=A
  981. a2b\=copy=A
  982. a1b\=copy=Z,copy=A
  983. /(?|(?<a>)(?<b>)(?<a>)|(?<a>)(?<b>)(?<a>))/I,dupnames
  984. /^(?P<A>a)(?P<A>b)/I,dupnames
  985. ab\=copy=A
  986. /^(?P<A>a)(?P<A>b)|cd/I,dupnames
  987. ab\=copy=A
  988. cd\=copy=A
  989. /^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/I,dupnames
  990. cdefgh\=copy=A
  991. /^((?P<A>a1)|(?P<A>a2)b)/I,dupnames
  992. a1b\=get=A
  993. a2b\=get=A
  994. a1b\=get=Z,get=A
  995. /^(?P<A>a)(?P<A>b)/I,dupnames
  996. ab\=get=A
  997. /^(?P<A>a)(?P<A>b)|cd/I,dupnames
  998. ab\=get=A
  999. cd\=get=A
  1000. /^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/I,dupnames
  1001. cdefgh\=get=A
  1002. /(?J)^((?P<A>a1)|(?P<A>a2)b)/I
  1003. a1b\=copy=A
  1004. a2b\=copy=A
  1005. /^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<A>d)/I
  1006. # In this next test, J is not set at the outer level; consequently it isn't set
  1007. # in the pattern's options; consequently pcre2_substring_get_byname() produces
  1008. # a random value.
  1009. /^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<C>d)/I
  1010. a bc d\=copy=A,copy=B,copy=C
  1011. /^(?P<A>a)?(?(A)a|b)/I
  1012. aabc
  1013. bc
  1014. \= Expect no match
  1015. abc
  1016. /(?:(?(ZZ)a|b)(?P<ZZ>X))+/I
  1017. bXaX
  1018. /(?:(?(2y)a|b)(X))+/I
  1019. /(?:(?(ZA)a|b)(?P<ZZ>X))+/I
  1020. /(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/I
  1021. bbXaaX
  1022. /(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/I
  1023. (b)\\Xa\\X
  1024. /(?P<ABC/I
  1025. /(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
  1026. bXXaYYaY
  1027. bXYaXXaX
  1028. /()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
  1029. bXXaYYaY
  1030. /\s*,\s*/I
  1031. \x0b,\x0b
  1032. \x0c,\x0d
  1033. /^abc/Im,newline=lf
  1034. xyz\nabc
  1035. xyz\r\nabc
  1036. \= Expect no match
  1037. xyz\rabc
  1038. xyzabc\r
  1039. xyzabc\rpqr
  1040. xyzabc\r\n
  1041. xyzabc\r\npqr
  1042. /^abc/Im,newline=crlf
  1043. xyz\r\nabclf>
  1044. \= Expect no match
  1045. xyz\nabclf
  1046. xyz\rabclf
  1047. /^abc/Im,newline=cr
  1048. xyz\rabc
  1049. \= Expect no match
  1050. xyz\nabc
  1051. xyz\r\nabc
  1052. /^abc/Im,newline=bad
  1053. /.*/I,newline=lf
  1054. abc\ndef
  1055. abc\rdef
  1056. abc\r\ndef
  1057. /.*/I,newline=cr
  1058. abc\ndef
  1059. abc\rdef
  1060. abc\r\ndef
  1061. /.*/I,newline=crlf
  1062. abc\ndef
  1063. abc\rdef
  1064. abc\r\ndef
  1065. /\w+(.)(.)?def/Is
  1066. abc\ndef
  1067. abc\rdef
  1068. abc\r\ndef
  1069. /(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/I
  1070. /()()()()()()()()()()()()()()()()()()()()
  1071. ()()()()()()()()()()()()()()()()()()()()
  1072. ()()()()()()()()()()()()()()()()()()()()
  1073. ()()()()()()()()()()()()()()()()()()()()
  1074. ()()()()()()()()()()()()()()()()()()()()
  1075. (.(.))/Ix
  1076. XY\=ovector=133
  1077. /(a*b|(?i:c*(?-i)d))/I
  1078. /()[ab]xyz/I
  1079. /(|)[ab]xyz/I
  1080. /(|c)[ab]xyz/I
  1081. /(|c?)[ab]xyz/I
  1082. /(d?|c?)[ab]xyz/I
  1083. /(d?|c)[ab]xyz/I
  1084. /^a*b\d/IB
  1085. /^a*+b\d/IB
  1086. /^a*?b\d/IB
  1087. /^a+A\d/IB
  1088. aaaA5
  1089. \= Expect no match
  1090. aaaa5
  1091. /^a*A\d/IBi
  1092. aaaA5
  1093. aaaa5
  1094. a5
  1095. /(a*|b*)[cd]/I
  1096. /(a+|b*)[cd]/I
  1097. /(a*|b+)[cd]/I
  1098. /(a+|b+)[cd]/I
  1099. /((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
  1100. ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
  1101. (((
  1102. a
  1103. ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
  1104. ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
  1105. )))
  1106. /Ix
  1107. large nest
  1108. /a*\d/B
  1109. /a*\D/B
  1110. /0*\d/B
  1111. /0*\D/B
  1112. /a*\s/B
  1113. /a*\S/B
  1114. / *\s/B
  1115. / *\S/B
  1116. /a*\w/B
  1117. /a*\W/B
  1118. /=*\w/B
  1119. /=*\W/B
  1120. /\d*a/B
  1121. /\d*2/B
  1122. /\d*\d/B
  1123. /\d*\D/B
  1124. /\d*\s/B
  1125. /\d*\S/B
  1126. /\d*\w/B
  1127. /\d*\W/B
  1128. /\D*a/B
  1129. /\D*2/B
  1130. /\D*\d/B
  1131. /\D*\D/B
  1132. /\D*\s/B
  1133. /\D*\S/B
  1134. /\D*\w/B
  1135. /\D*\W/B
  1136. /\s*a/B
  1137. /\s*2/B
  1138. /\s*\d/B
  1139. /\s*\D/B
  1140. /\s*\s/B
  1141. /\s*\S/B
  1142. /\s*\w/B
  1143. /\s*\W/B
  1144. /\S*a/B
  1145. /\S*2/B
  1146. /\S*\d/B
  1147. /\S*\D/B
  1148. /\S*\s/B
  1149. /\S*\S/B
  1150. /\S*\w/B
  1151. /\S*\W/B
  1152. /\w*a/B
  1153. /\w*2/B
  1154. /\w*\d/B
  1155. /\w*\D/B
  1156. /\w*\s/B
  1157. /\w*\S/B
  1158. /\w*\w/B
  1159. /\w*\W/B
  1160. /\W*a/B
  1161. /\W*2/B
  1162. /\W*\d/B
  1163. /\W*\D/B
  1164. /\W*\s/B
  1165. /\W*\S/B
  1166. /\W*\w/B
  1167. /\W*\W/B
  1168. /[^a]+a/B
  1169. /[^a]+a/Bi
  1170. /[^a]+A/Bi
  1171. /[^a]+b/B
  1172. /[^a]+\d/B
  1173. /a*[^a]/B
  1174. /(?P<abc>x)(?P<xyz>y)/I
  1175. xy\=copy=abc,copy=xyz
  1176. /(?<abc>x)(?'xyz'y)/I
  1177. xy\=copy=abc,copy=xyz
  1178. /(?<abc'x)(?'xyz'y)/I
  1179. /(?<abc>x)(?'xyz>y)/I
  1180. /(?P'abc'x)(?P<xyz>y)/I
  1181. /^(?:(?(ZZ)a|b)(?<ZZ>X))+/
  1182. bXaX
  1183. bXbX
  1184. \= Expect no match
  1185. aXaX
  1186. aXbX
  1187. /^(?P>abc)(?<abcd>xxx)/
  1188. /^(?P>abc)(?<abc>x|y)/
  1189. xx
  1190. xy
  1191. yy
  1192. yx
  1193. /^(?P>abc)(?P<abc>x|y)/
  1194. xx
  1195. xy
  1196. yy
  1197. yx
  1198. /^((?(abc)a|b)(?<abc>x|y))+/
  1199. bxay
  1200. bxby
  1201. \= Expect no match
  1202. axby
  1203. /^(((?P=abc)|X)(?<abc>x|y))+/
  1204. XxXxxx
  1205. XxXyyx
  1206. XxXyxx
  1207. \= Expect no match
  1208. x
  1209. /^(?1)(abc)/
  1210. abcabc
  1211. /^(?:(?:\1|X)(a|b))+/
  1212. Xaaa
  1213. Xaba
  1214. /^[\E\Qa\E-\Qz\E]+/B
  1215. /^[a\Q]bc\E]/B
  1216. /^[a-\Q\E]/B
  1217. /^(?P>abc)[()](?<abc>)/B
  1218. /^((?(abc)y)[()](?P<abc>x))+/B
  1219. (xy)x
  1220. /^(?P>abc)\Q()\E(?<abc>)/B
  1221. /^(?P>abc)[a\Q(]\E(](?<abc>)/B
  1222. /^(?P>abc) # this is (a comment)
  1223. (?<abc>)/Bx
  1224. /^\W*(?:(?<one>(?<two>.)\W*(?&one)\W*\k<two>|)|(?<three>(?<four>.)\W*(?&three)\W*\k'four'|\W*.\W*))\W*$/Ii
  1225. 1221
  1226. Satan, oscillate my metallic sonatas!
  1227. A man, a plan, a canal: Panama!
  1228. Able was I ere I saw Elba.
  1229. \= Expect no match
  1230. The quick brown fox
  1231. /(?=(\w+))\1:/I
  1232. abcd:
  1233. /(?=(?'abc'\w+))\k<abc>:/I
  1234. abcd:
  1235. /(?'abc'a|b)(?<abc>d|e)\k<abc>{2}/dupnames
  1236. adaa
  1237. \= Expect no match
  1238. addd
  1239. adbb
  1240. /(?'abc'a|b)(?<abc>d|e)(?&abc){2}/dupnames
  1241. bdaa
  1242. bdab
  1243. \= Expect no match
  1244. bddd
  1245. /(?(<bc))/
  1246. /(?(''))/
  1247. /(?('R')stuff)/
  1248. /((abc (?(R) (?(R1)1) (?(R2)2) X | (?1) (?2) (?R) ))) /x
  1249. abcabc1Xabc2XabcXabcabc
  1250. /(?<A> (?'B' abc (?(R) (?(R&A)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
  1251. abcabc1Xabc2XabcXabcabc
  1252. /(?<A> (?'B' abc (?(R) (?(R&C)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
  1253. /^(?(DEFINE) abc | xyz ) /x
  1254. /(?(DEFINE) abc) xyz/Ix
  1255. /(a|)*\d/
  1256. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4\=ovector=0
  1257. \= Expect no match
  1258. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=ovector=0
  1259. /^a.b/newline=lf
  1260. a\rb
  1261. \= Expect no match
  1262. a\nb
  1263. /^a.b/newline=cr
  1264. a\nb
  1265. \= Expect no match
  1266. a\rb
  1267. /^a.b/newline=anycrlf
  1268. a\x85b
  1269. \= Expect no match
  1270. a\rb
  1271. /^a.b/newline=any
  1272. \= Expect no match
  1273. a\nb
  1274. a\rb
  1275. a\x85b
  1276. /^abc./gmx,newline=any
  1277. abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
  1278. /abc.$/gmx,newline=any
  1279. abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc7 abc9
  1280. /^a\Rb/bsr=unicode
  1281. a\nb
  1282. a\rb
  1283. a\r\nb
  1284. a\x0bb
  1285. a\x0cb
  1286. a\x85b
  1287. \= Expect no match
  1288. a\n\rb
  1289. /^a\R*b/bsr=unicode
  1290. ab
  1291. a\nb
  1292. a\rb
  1293. a\r\nb
  1294. a\x0bb
  1295. a\x0cb
  1296. a\x85b
  1297. a\n\rb
  1298. a\n\r\x85\x0cb
  1299. /^a\R+b/bsr=unicode
  1300. a\nb
  1301. a\rb
  1302. a\r\nb
  1303. a\x0bb
  1304. a\x0cb
  1305. a\x85b
  1306. a\n\rb
  1307. a\n\r\x85\x0cb
  1308. \= Expect no match
  1309. ab
  1310. /^a\R{1,3}b/bsr=unicode
  1311. a\nb
  1312. a\n\rb
  1313. a\n\r\x85b
  1314. a\r\n\r\nb
  1315. a\r\n\r\n\r\nb
  1316. a\n\r\n\rb
  1317. a\n\n\r\nb
  1318. \= Expect no match
  1319. a\n\n\n\rb
  1320. a\r
  1321. /(?&abc)X(?<abc>P)/I
  1322. abcPXP123
  1323. /(?1)X(?<abc>P)/I
  1324. abcPXP123
  1325. /(?:a(?&abc)b)*(?<abc>x)/
  1326. 123axbaxbaxbx456
  1327. 123axbaxbaxb456
  1328. /(?:a(?&abc)b){1,5}(?<abc>x)/
  1329. 123axbaxbaxbx456
  1330. /(?:a(?&abc)b){2,5}(?<abc>x)/
  1331. 123axbaxbaxbx456
  1332. /(?:a(?&abc)b){2,}(?<abc>x)/
  1333. 123axbaxbaxbx456
  1334. /(abc)(?i:(?1))/
  1335. defabcabcxyz
  1336. \= Expect no match
  1337. DEFabcABCXYZ
  1338. /(abc)(?:(?i)(?1))/
  1339. defabcabcxyz
  1340. \= Expect no match
  1341. DEFabcABCXYZ
  1342. /^(a)\g-2/
  1343. /^(a)\g/
  1344. /^(a)\g{0}/
  1345. /^(a)\g{3/
  1346. /^(a)\g{aa}/
  1347. /^a.b/newline=lf
  1348. a\rb
  1349. \= Expect no match
  1350. a\nb
  1351. /.+foo/
  1352. afoo
  1353. \= Expect no match
  1354. \r\nfoo
  1355. \nfoo
  1356. /.+foo/newline=crlf
  1357. afoo
  1358. \nfoo
  1359. \= Expect no match
  1360. \r\nfoo
  1361. /.+foo/newline=any
  1362. afoo
  1363. \= Expect no match
  1364. \nfoo
  1365. \r\nfoo
  1366. /.+foo/s
  1367. afoo
  1368. \r\nfoo
  1369. \nfoo
  1370. /^$/gm,newline=any
  1371. abc\r\rxyz
  1372. abc\n\rxyz
  1373. \= Expect no match
  1374. abc\r\nxyz
  1375. /(?m)^$/g,newline=any,aftertext
  1376. abc\r\n\r\n
  1377. /(?m)^$|^\r\n/g,newline=any,aftertext
  1378. abc\r\n\r\n
  1379. /(?m)$/g,newline=any,aftertext
  1380. abc\r\n\r\n
  1381. /abc.$/gmx,newline=anycrlf
  1382. abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
  1383. /^X/m
  1384. XABC
  1385. \= Expect no match
  1386. XABC\=notbol
  1387. /(ab|c)(?-1)/B
  1388. abc
  1389. /xy(?+1)(abc)/B
  1390. xyabcabc
  1391. \= Expect no match
  1392. xyabc
  1393. /x(?-0)y/
  1394. /x(?-1)y/
  1395. /x(?+0)y/
  1396. /x(?+1)y/
  1397. /^(abc)?(?(-1)X|Y)/B
  1398. abcX
  1399. Y
  1400. \= Expect no match
  1401. abcY
  1402. /^((?(+1)X|Y)(abc))+/B
  1403. YabcXabc
  1404. YabcXabcXabc
  1405. \= Expect no match
  1406. XabcXabc
  1407. /(?(-1)a)/B
  1408. /((?(-1)a))/B
  1409. /((?(-2)a))/B
  1410. /^(?(+1)X|Y)(.)/B
  1411. Y!
  1412. /(?<A>tom|bon)-\k{A}/
  1413. tom-tom
  1414. bon-bon
  1415. \= Expect no match
  1416. tom-bon
  1417. /\g{A/
  1418. /(?|(abc)|(xyz))/B
  1419. >abc<
  1420. >xyz<
  1421. /(x)(?|(abc)|(xyz))(x)/B
  1422. xabcx
  1423. xxyzx
  1424. /(x)(?|(abc)(pqr)|(xyz))(x)/B
  1425. xabcpqrx
  1426. xxyzx
  1427. /\H++X/B
  1428. \= Expect no match
  1429. XXXX
  1430. /\H+\hY/B
  1431. XXXX Y
  1432. /\H+ Y/B
  1433. /\h+A/B
  1434. /\v*B/B
  1435. /\V+\x0a/B
  1436. /A+\h/B
  1437. / *\H/B
  1438. /A*\v/B
  1439. /\x0b*\V/B
  1440. /\d+\h/B
  1441. /\d*\v/B
  1442. /S+\h\S+\v/B
  1443. /\w{3,}\h\w+\v/B
  1444. /\h+\d\h+\w\h+\S\h+\H/B
  1445. /\v+\d\v+\w\v+\S\v+\V/B
  1446. /\H+\h\H+\d/B
  1447. /\V+\v\V+\w/B
  1448. /\( (?: [^()]* | (?R) )* \)/x
  1449. (0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(00)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)\=jitstack=1024
  1450. /[\E]AAA/
  1451. /[\Q\E]AAA/
  1452. /[^\E]AAA/
  1453. /[^\Q\E]AAA/
  1454. /[\E^]AAA/
  1455. /[\Q\E^]AAA/
  1456. /A(*PRUNE)B(*SKIP)C(*THEN)D(*COMMIT)E(*F)F(*FAIL)G(?!)H(*ACCEPT)I/B
  1457. /^a+(*FAIL)/auto_callout
  1458. \= Expect no match
  1459. aaaaaa
  1460. /a+b?c+(*FAIL)/auto_callout
  1461. \= Expect no match
  1462. aaabccc
  1463. /a+b?(*PRUNE)c+(*FAIL)/auto_callout
  1464. \= Expect no match
  1465. aaabccc
  1466. /a+b?(*COMMIT)c+(*FAIL)/auto_callout
  1467. \= Expect no match
  1468. aaabccc
  1469. /a+b?(*SKIP)c+(*FAIL)/auto_callout
  1470. \= Expect no match
  1471. aaabcccaaabccc
  1472. /a+b?(*THEN)c+(*FAIL)/auto_callout
  1473. \= Expect no match
  1474. aaabccc
  1475. /a(*MARK)b/
  1476. /\g6666666666/
  1477. /[\g6666666666]/B
  1478. /(?1)\c[/
  1479. /.+A/newline=crlf
  1480. \= Expect no match
  1481. \r\nA
  1482. /\nA/newline=crlf
  1483. \r\nA
  1484. /[\r\n]A/newline=crlf
  1485. \r\nA
  1486. /(\r|\n)A/newline=crlf
  1487. \r\nA
  1488. /a(*CR)b/
  1489. /(*CR)a.b/
  1490. a\nb
  1491. \= Expect no match
  1492. a\rb
  1493. /(*CR)a.b/newline=lf
  1494. a\nb
  1495. \= Expect no match
  1496. a\rb
  1497. /(*LF)a.b/newline=CRLF
  1498. a\rb
  1499. \= Expect no match
  1500. a\nb
  1501. /(*CRLF)a.b/
  1502. a\rb
  1503. a\nb
  1504. \= Expect no match
  1505. a\r\nb
  1506. /(*ANYCRLF)a.b/newline=CR
  1507. \= Expect no match
  1508. a\rb
  1509. a\nb
  1510. a\r\nb
  1511. /(*ANY)a.b/newline=cr
  1512. \= Expect no match
  1513. a\rb
  1514. a\nb
  1515. a\r\nb
  1516. a\x85b
  1517. /(*ANY).*/g
  1518. abc\r\ndef
  1519. /(*ANYCRLF).*/g
  1520. abc\r\ndef
  1521. /(*CRLF).*/g
  1522. abc\r\ndef
  1523. /(*NUL)^.*/
  1524. a\nb\x00ccc
  1525. /(*NUL)^.*/s
  1526. a\nb\x00ccc
  1527. /^x/m,newline=NUL
  1528. ab\x00xy
  1529. /'#comment' 0d 0a 00 '^x\' 0a 'y'/x,newline=nul,hex
  1530. x\nyz
  1531. /(*NUL)^X\NY/
  1532. X\nY
  1533. X\rY
  1534. \= Expect no match
  1535. X\x00Y
  1536. /a\Rb/I,bsr=anycrlf
  1537. a\rb
  1538. a\nb
  1539. a\r\nb
  1540. \= Expect no match
  1541. a\x85b
  1542. a\x0bb
  1543. /a\Rb/I,bsr=unicode
  1544. a\rb
  1545. a\nb
  1546. a\r\nb
  1547. a\x85b
  1548. a\x0bb
  1549. /a\R?b/I,bsr=anycrlf
  1550. a\rb
  1551. a\nb
  1552. a\r\nb
  1553. \= Expect no match
  1554. a\x85b
  1555. a\x0bb
  1556. /a\R?b/I,bsr=unicode
  1557. a\rb
  1558. a\nb
  1559. a\r\nb
  1560. a\x85b
  1561. a\x0bb
  1562. /a\R{2,4}b/I,bsr=anycrlf
  1563. a\r\n\nb
  1564. a\n\r\rb
  1565. a\r\n\r\n\r\n\r\nb
  1566. \= Expect no match
  1567. a\x85\x85b
  1568. a\x0b\x0bb
  1569. /a\R{2,4}b/I,bsr=unicode
  1570. a\r\rb
  1571. a\n\n\nb
  1572. a\r\n\n\r\rb
  1573. a\x85\x85b
  1574. a\x0b\x0bb
  1575. \= Expect no match
  1576. a\r\r\r\r\rb
  1577. /(*BSR_ANYCRLF)a\Rb/I
  1578. a\nb
  1579. a\rb
  1580. /(*BSR_UNICODE)a\Rb/I
  1581. a\x85b
  1582. /(*BSR_ANYCRLF)(*CRLF)a\Rb/I
  1583. a\nb
  1584. a\rb
  1585. /(*CRLF)(*BSR_UNICODE)a\Rb/I
  1586. a\x85b
  1587. /(*CRLF)(*BSR_ANYCRLF)(*CR)ab/I
  1588. /(?<a>)(?&)/
  1589. /(?<abc>)(?&a)/
  1590. /(?<a>)(?&aaaaaaaaaaaaaaaaaaaaaaa)/
  1591. /(?+-a)/
  1592. /(?-+a)/
  1593. /(?(-1))/
  1594. /(?(+10))/
  1595. /(?(10))/
  1596. /(?(+2))()()/
  1597. /(?(2))()()/
  1598. /\k''/
  1599. /\k<>/
  1600. /\k{}/
  1601. /\k/
  1602. /\kabc/
  1603. /(?P=)/
  1604. /(?P>)/
  1605. /[[:foo:]]/
  1606. /[[:1234:]]/
  1607. /[[:f\oo:]]/
  1608. /[[: :]]/
  1609. /[[:...:]]/
  1610. /[[:l\ower:]]/
  1611. /[[:abc\:]]/
  1612. /[abc[:x\]pqr:]]/
  1613. /[[:a\dz:]]/
  1614. /(^(a|b\g<-1'c))/
  1615. /^(?+1)(?<a>x|y){0}z/
  1616. xzxx
  1617. yzyy
  1618. \= Expect no match
  1619. xxz
  1620. /(\3)(\1)(a)/
  1621. \= Expect no match
  1622. cat
  1623. /(\3)(\1)(a)/allow_empty_class,match_unset_backref,dupnames
  1624. cat
  1625. /TA]/
  1626. The ACTA] comes
  1627. /TA]/allow_empty_class,match_unset_backref,dupnames
  1628. The ACTA] comes
  1629. /(?2)[]a()b](abc)/
  1630. abcbabc
  1631. /(?2)[^]a()b](abc)/
  1632. abcbabc
  1633. /(?1)[]a()b](abc)/
  1634. abcbabc
  1635. \= Expect no match
  1636. abcXabc
  1637. /(?1)[^]a()b](abc)/
  1638. abcXabc
  1639. \= Expect no match
  1640. abcbabc
  1641. /(?2)[]a()b](abc)(xyz)/
  1642. xyzbabcxyz
  1643. /(?&N)[]a(?<N>)](?<M>abc)/
  1644. abc<abc
  1645. /(?&N)[]a(?<N>)](abc)/
  1646. abc<abc
  1647. /a[]b/
  1648. /a[^]b/
  1649. /a[]b/allow_empty_class,match_unset_backref,dupnames
  1650. \= Expect no match
  1651. ab
  1652. /a[]+b/allow_empty_class,match_unset_backref,dupnames
  1653. \= Expect no match
  1654. ab
  1655. /a[]*+b/allow_empty_class,match_unset_backref,dupnames
  1656. \= Expect no match
  1657. ab
  1658. /a[^]b/allow_empty_class,match_unset_backref,dupnames
  1659. aXb
  1660. a\nb
  1661. \= Expect no match
  1662. ab
  1663. /a[^]+b/allow_empty_class,match_unset_backref,dupnames
  1664. aXb
  1665. a\nX\nXb
  1666. \= Expect no match
  1667. ab
  1668. /a(?!)b/B
  1669. /(?!)?a/B
  1670. ab
  1671. /a(*FAIL)+b/
  1672. /(abc|pqr|123){0}[xyz]/I
  1673. /(?(?=.*b)b|^)/I,auto_callout
  1674. adc
  1675. abc
  1676. /(?(?=b).*b|^d)/I
  1677. /(?(?=.*b).*b|^d)/I
  1678. /xyz/auto_callout
  1679. xyz
  1680. abcxyz
  1681. \= Expect no match
  1682. abc
  1683. abcxypqr
  1684. /xyz/auto_callout,no_start_optimize
  1685. abcxyz
  1686. \= Expect no match
  1687. abc
  1688. abcxypqr
  1689. /(*NO_START_OPT)xyz/auto_callout
  1690. abcxyz
  1691. /(*NO_AUTO_POSSESS)a+b/B
  1692. /xyz/auto_callout,no_start_optimize
  1693. abcxyz
  1694. /^"((?(?=[a])[^"])|b)*"$/auto_callout
  1695. "ab"
  1696. /^"((?(?=[a])[^"])|b)*"$/
  1697. "ab"
  1698. /^X(?5)(a)(?|(b)|(q))(c)(d)Y/
  1699. XYabcdY
  1700. /^X(?&N)(a)(?|(b)|(q))(c)(d)(?<N>Y)/
  1701. XYabcdY
  1702. /Xa{2,4}b/
  1703. X\=ps
  1704. Xa\=ps
  1705. Xaa\=ps
  1706. Xaaa\=ps
  1707. Xaaaa\=ps
  1708. /Xa{2,4}?b/
  1709. X\=ps
  1710. Xa\=ps
  1711. Xaa\=ps
  1712. Xaaa\=ps
  1713. Xaaaa\=ps
  1714. /Xa{2,4}+b/
  1715. X\=ps
  1716. Xa\=ps
  1717. Xaa\=ps
  1718. Xaaa\=ps
  1719. Xaaaa\=ps
  1720. /X\d{2,4}b/
  1721. X\=ps
  1722. X3\=ps
  1723. X33\=ps
  1724. X333\=ps
  1725. X3333\=ps
  1726. /X\d{2,4}?b/
  1727. X\=ps
  1728. X3\=ps
  1729. X33\=ps
  1730. X333\=ps
  1731. X3333\=ps
  1732. /X\d{2,4}+b/
  1733. X\=ps
  1734. X3\=ps
  1735. X33\=ps
  1736. X333\=ps
  1737. X3333\=ps
  1738. /X\D{2,4}b/
  1739. X\=ps
  1740. Xa\=ps
  1741. Xaa\=ps
  1742. Xaaa\=ps
  1743. Xaaaa\=ps
  1744. /X\D{2,4}?b/
  1745. X\=ps
  1746. Xa\=ps
  1747. Xaa\=ps
  1748. Xaaa\=ps
  1749. Xaaaa\=ps
  1750. /X\D{2,4}+b/
  1751. X\=ps
  1752. Xa\=ps
  1753. Xaa\=ps
  1754. Xaaa\=ps
  1755. Xaaaa\=ps
  1756. /X[abc]{2,4}b/
  1757. X\=ps
  1758. Xa\=ps
  1759. Xaa\=ps
  1760. Xaaa\=ps
  1761. Xaaaa\=ps
  1762. /X[abc]{2,4}?b/
  1763. X\=ps
  1764. Xa\=ps
  1765. Xaa\=ps
  1766. Xaaa\=ps
  1767. Xaaaa\=ps
  1768. /X[abc]{2,4}+b/
  1769. X\=ps
  1770. Xa\=ps
  1771. Xaa\=ps
  1772. Xaaa\=ps
  1773. Xaaaa\=ps
  1774. /X[^a]{2,4}b/
  1775. X\=ps
  1776. Xz\=ps
  1777. Xzz\=ps
  1778. Xzzz\=ps
  1779. Xzzzz\=ps
  1780. /X[^a]{2,4}?b/
  1781. X\=ps
  1782. Xz\=ps
  1783. Xzz\=ps
  1784. Xzzz\=ps
  1785. Xzzzz\=ps
  1786. /X[^a]{2,4}+b/
  1787. X\=ps
  1788. Xz\=ps
  1789. Xzz\=ps
  1790. Xzzz\=ps
  1791. Xzzzz\=ps
  1792. /(Y)X\1{2,4}b/
  1793. YX\=ps
  1794. YXY\=ps
  1795. YXYY\=ps
  1796. YXYYY\=ps
  1797. YXYYYY\=ps
  1798. /(Y)X\1{2,4}?b/
  1799. YX\=ps
  1800. YXY\=ps
  1801. YXYY\=ps
  1802. YXYYY\=ps
  1803. YXYYYY\=ps
  1804. /(Y)X\1{2,4}+b/
  1805. YX\=ps
  1806. YXY\=ps
  1807. YXYY\=ps
  1808. YXYYY\=ps
  1809. YXYYYY\=ps
  1810. /\++\KZ|\d+X|9+Y/startchar
  1811. ++++123999\=ps
  1812. ++++123999Y\=ps
  1813. ++++Z1234\=ps
  1814. /Z(*F)/
  1815. \= Expect no match
  1816. Z\=ps
  1817. ZA\=ps
  1818. /Z(?!)/
  1819. \= Expect no match
  1820. Z\=ps
  1821. ZA\=ps
  1822. /dog(sbody)?/
  1823. dogs\=ps
  1824. dogs\=ph
  1825. /dog(sbody)??/
  1826. dogs\=ps
  1827. dogs\=ph
  1828. /dog|dogsbody/
  1829. dogs\=ps
  1830. dogs\=ph
  1831. /dogsbody|dog/
  1832. dogs\=ps
  1833. dogs\=ph
  1834. /\bthe cat\b/
  1835. the cat\=ps
  1836. the cat\=ph
  1837. /abc/
  1838. abc\=ps
  1839. abc\=ph
  1840. /abc\K123/startchar
  1841. xyzabc123pqr
  1842. xyzabc12\=ps
  1843. xyzabc12\=ph
  1844. /(?<=abc)123/
  1845. xyzabc123pqr
  1846. xyzabc12\=ps
  1847. xyzabc12\=ph
  1848. /\babc\b/
  1849. +++abc+++
  1850. +++ab\=ps
  1851. +++ab\=ph
  1852. /(?&word)(?&element)(?(DEFINE)(?<element><[^m][^>]>[^<])(?<word>\w*+))/B
  1853. /(?&word)(?&element)(?(DEFINE)(?<element><[^\d][^>]>[^<])(?<word>\w*+))/B
  1854. /(ab)(x(y)z(cd(*ACCEPT)))pq/B
  1855. /abc\K/aftertext,startchar
  1856. abcdef
  1857. abcdef\=notempty_atstart
  1858. xyzabcdef\=notempty_atstart
  1859. \= Expect no match
  1860. abcdef\=notempty
  1861. xyzabcdef\=notempty
  1862. /^(?:(?=abc)|abc\K)/aftertext,startchar
  1863. abcdef
  1864. abcdef\=notempty_atstart
  1865. \= Expect no match
  1866. abcdef\=notempty
  1867. /a?b?/aftertext
  1868. xyz
  1869. xyzabc
  1870. xyzabc\=notempty
  1871. xyzabc\=notempty_atstart
  1872. xyz\=notempty_atstart
  1873. \= Expect no match
  1874. xyz\=notempty
  1875. /^a?b?/aftertext
  1876. xyz
  1877. xyzabc
  1878. \= Expect no match
  1879. xyzabc\=notempty
  1880. xyzabc\=notempty_atstart
  1881. xyz\=notempty_atstart
  1882. xyz\=notempty
  1883. /^(?<name>a|b\g<name>c)/
  1884. aaaa
  1885. bacxxx
  1886. bbaccxxx
  1887. bbbacccxx
  1888. /^(?<name>a|b\g'name'c)/
  1889. aaaa
  1890. bacxxx
  1891. bbaccxxx
  1892. bbbacccxx
  1893. /^(a|b\g<1>c)/
  1894. aaaa
  1895. bacxxx
  1896. bbaccxxx
  1897. bbbacccxx
  1898. /^(a|b\g'1'c)/
  1899. aaaa
  1900. bacxxx
  1901. bbaccxxx
  1902. bbbacccxx
  1903. /^(a|b\g'-1'c)/
  1904. aaaa
  1905. bacxxx
  1906. bbaccxxx
  1907. bbbacccxx
  1908. /(^(a|b\g<-1>c))/
  1909. aaaa
  1910. bacxxx
  1911. bbaccxxx
  1912. bbbacccxx
  1913. /(?-i:\g<name>)(?i:(?<name>a))/
  1914. XaaX
  1915. XAAX
  1916. /(?i:\g<name>)(?-i:(?<name>a))/
  1917. XaaX
  1918. \= Expect no match
  1919. XAAX
  1920. /(?-i:\g<+1>)(?i:(a))/
  1921. XaaX
  1922. XAAX
  1923. /(?=(?<regex>(?#simplesyntax)\$(?<name>[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)(?:\[(?<index>[a-zA-Z0-9_\x{7f}-\x{ff}]+|\$\g<name>)\]|->\g<name>(\(.*?\))?)?|(?#simple syntax withbraces)\$\{(?:\g<name>(?<indices>\[(?:\g<index>|'(?:\\.|[^'\\])*'|"(?:\g<regex>|\\.|[^"\\])*")\])?|\g<complex>|\$\{\g<complex>\})\}|(?#complexsyntax)\{(?<complex>\$(?<segment>\g<name>(\g<indices>*|\(.*?\))?)(?:->\g<segment>)*|\$\g<complex>|\$\{\g<complex>\})\}))\{/
  1924. /(?<n>a|b|c)\g<n>*/
  1925. abc
  1926. accccbbb
  1927. /^X(?7)(a)(?|(b)|(q)(r)(s))(c)(d)(Y)/
  1928. XYabcdY
  1929. /(?<=b(?1)|zzz)(a)/
  1930. xbaax
  1931. xzzzax
  1932. /(a)(?<=b\1)/
  1933. /(a)(?<=b+(?1))/
  1934. /(a+)(?<=b(?1))/
  1935. /(a(?<=b(?1)))/
  1936. /(?<=b(?1))xyz/
  1937. /(?<=b(?1))xyz(b+)pqrstuvew/
  1938. /(a|bc)\1/I
  1939. /(a|bc)\1{2,3}/I
  1940. /(a|bc)(?1)/I
  1941. /(a|b\1)(a|b\1)/I
  1942. /(a|b\1){2}/I
  1943. /(a|bbbb\1)(a|bbbb\1)/I
  1944. /(a|bbbb\1){2}/I
  1945. /^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]/I
  1946. /<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>/Iis
  1947. "(?>.*/)foo"I
  1948. /(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /Ix
  1949. /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/Ii
  1950. /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/I
  1951. /<a[\s]+href[\s]*=[\s]* # find <a href=
  1952. ([\"\'])? # find single or double quote
  1953. (?(1) (.*?)\1 | ([^\s]+)) # if quote found, match up to next matching
  1954. # quote, otherwise match up to next space
  1955. /Iisx
  1956. /^(?!:) # colon disallowed at start
  1957. (?: # start of item
  1958. (?: [0-9a-f]{1,4} | # 1-4 hex digits or
  1959. (?(1)0 | () ) ) # if null previously matched, fail; else null
  1960. : # followed by colon
  1961. ){1,7} # end item; 1-7 of them required
  1962. [0-9a-f]{1,4} $ # final hex number at end of string
  1963. (?(1)|.) # check that there was an empty component
  1964. /Iix
  1965. /(?|(?<a>A)|(?<a>B))/I
  1966. AB\=copy=a
  1967. BA\=copy=a
  1968. /(?|(?<a>A)|(?<b>B))/
  1969. /(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |
  1970. b(?<quote> (?<apostrophe>')|(?<realquote>")) )
  1971. (?('quote')[a-z]+|[0-9]+)/Ix,dupnames
  1972. a"aaaaa
  1973. b"aaaaa
  1974. \= Expect no match
  1975. b"11111
  1976. a"11111
  1977. /^(?|(a)(b)(c)(?<D>d)|(?<D>e)) (?('D')X|Y)/IBx,dupnames
  1978. abcdX
  1979. eX
  1980. \= Expect no match
  1981. abcdY
  1982. ey
  1983. /(?<A>a) (b)(c) (?<A>d (?(R&A)$ | (?4)) )/IBx,dupnames
  1984. abcdd
  1985. \= Expect no match
  1986. abcdde
  1987. /abcd*/
  1988. xxxxabcd\=ps
  1989. xxxxabcd\=ph
  1990. /abcd*/i
  1991. xxxxabcd\=ps
  1992. xxxxabcd\=ph
  1993. XXXXABCD\=ps
  1994. XXXXABCD\=ph
  1995. /abc\d*/
  1996. xxxxabc1\=ps
  1997. xxxxabc1\=ph
  1998. /(a)bc\1*/
  1999. xxxxabca\=ps
  2000. xxxxabca\=ph
  2001. /abc[de]*/
  2002. xxxxabcde\=ps
  2003. xxxxabcde\=ph
  2004. /(\3)(\1)(a)/allow_empty_class,match_unset_backref,dupnames
  2005. cat
  2006. /(\3)(\1)(a)/I,allow_empty_class,match_unset_backref,dupnames
  2007. cat
  2008. /(\3)(\1)(a)/I
  2009. \= Expect no match
  2010. cat
  2011. /i(?(DEFINE)(?<s>a))/I
  2012. i
  2013. /()i(?(1)a)/I
  2014. ia
  2015. /(?i)a(?-i)b|c/B
  2016. XabX
  2017. XAbX
  2018. CcC
  2019. \= Expect no match
  2020. XABX
  2021. /(?i)a(?s)b|c/B
  2022. /(?i)a(?s-i)b|c/B
  2023. /^(ab(c\1)d|x){2}$/B
  2024. xabcxd
  2025. /^(?&t)*+(?(DEFINE)(?<t>.))$/B
  2026. /^(?&t)*(?(DEFINE)(?<t>.))$/B
  2027. # This one is here because Perl gives the match as "b" rather than "ab". I
  2028. # believe this to be a Perl bug.
  2029. /(?>a\Kb)z|(ab)/
  2030. ab\=startchar
  2031. /(?P<L1>(?P<L2>0|)|(?P>L2)(?P>L1))/
  2032. abcd
  2033. 0abc
  2034. /abc(*MARK:)pqr/
  2035. /abc(*:)pqr/
  2036. /(*COMMIT:X)/B
  2037. # This should, and does, fail. In Perl, it does not, which I think is a
  2038. # bug because replacing the B in the pattern by (B|D) does make it fail.
  2039. # Turning off Perl's optimization by inserting (??{""}) also makes it fail.
  2040. /A(*COMMIT)B/aftertext,mark
  2041. \= Expect no match
  2042. ACABX
  2043. # These should be different, but in Perl they are not, which I think
  2044. # is a bug in Perl.
  2045. /A(*THEN)B|A(*THEN)C/mark
  2046. AC
  2047. /A(*PRUNE)B|A(*PRUNE)C/mark
  2048. \= Expect no match
  2049. AC
  2050. # Mark names can be duplicated. Perl doesn't give a mark for this one,
  2051. # though PCRE2 does.
  2052. /^A(*:A)B|^X(*:A)Y/mark
  2053. \= Expect no match
  2054. XAQQ
  2055. # COMMIT at the start of a pattern should be the same as an anchor. Perl
  2056. # optimizations defeat this. So does the PCRE2 optimization unless we disable
  2057. # it.
  2058. /(*COMMIT)ABC/
  2059. ABCDEFG
  2060. /(*COMMIT)ABC/no_start_optimize
  2061. \= Expect no match
  2062. DEFGABC
  2063. /^(ab (c+(*THEN)cd) | xyz)/x
  2064. \= Expect no match
  2065. abcccd
  2066. /^(ab (c+(*PRUNE)cd) | xyz)/x
  2067. \= Expect no match
  2068. abcccd
  2069. /^(ab (c+(*FAIL)cd) | xyz)/x
  2070. \= Expect no match
  2071. abcccd
  2072. # Perl gets some of these wrong
  2073. /(?>.(*ACCEPT))*?5/
  2074. abcde
  2075. /(.(*ACCEPT))*?5/
  2076. abcde
  2077. /(.(*ACCEPT))5/
  2078. abcde
  2079. /(.(*ACCEPT))*5/
  2080. abcde
  2081. /A\NB./B
  2082. ACBD
  2083. \= Expect no match
  2084. A\nB
  2085. ACB\n
  2086. /A\NB./Bs
  2087. ACBD
  2088. ACB\n
  2089. \= Expect no match
  2090. A\nB
  2091. /A\NB/newline=crlf
  2092. A\nB
  2093. A\rB
  2094. \= Expect no match
  2095. A\r\nB
  2096. /\R+b/B
  2097. /\R+\n/B
  2098. /\R+\d/B
  2099. /\d*\R/B
  2100. /\s*\R/B
  2101. \x20\x0a
  2102. \x20\x0d
  2103. \x20\x0d\x0a
  2104. /\S*\R/B
  2105. a\x0a
  2106. /X\h*\R/B
  2107. X\x20\x0a
  2108. /X\H*\R/B
  2109. X\x0d\x0a
  2110. /X\H+\R/B
  2111. X\x0d\x0a
  2112. /X\H++\R/B
  2113. \= Expect no match
  2114. X\x0d\x0a
  2115. /(?<=abc)def/
  2116. abc\=ph
  2117. /abc$/
  2118. abc
  2119. abc\=ps
  2120. abc\=ph
  2121. /abc$/m
  2122. abc
  2123. abc\n
  2124. abc\=ph
  2125. abc\n\=ph
  2126. abc\=ps
  2127. abc\n\=ps
  2128. /abc\z/
  2129. abc
  2130. abc\=ps
  2131. abc\=ph
  2132. /abc\Z/
  2133. abc
  2134. abc\=ps
  2135. abc\=ph
  2136. /abc\b/
  2137. abc
  2138. abc\=ps
  2139. abc\=ph
  2140. /abc\B/
  2141. abc\=ps
  2142. abc\=ph
  2143. \= Expect no match
  2144. abc
  2145. /.+/
  2146. \= Bad offsets
  2147. abc\=offset=4
  2148. abc\=offset=-4
  2149. \= Valid data
  2150. abc\=offset=0
  2151. abc\=offset=1
  2152. abc\=offset=2
  2153. \= Expect no match
  2154. abc\=offset=3
  2155. /^\cģ/
  2156. /(?P<abn>(?P=abn)xxx)/B
  2157. /(a\1z)/B
  2158. /(?P<abn>(?P=abn)(?<badstufxxx)/B
  2159. /(?P<abn>(?P=axn)xxx)/B
  2160. /(?P<abn>(?P=axn)xxx)(?<axn>yy)/B
  2161. # These tests are here because Perl gets the first one wrong.
  2162. /(\R*)(.)/s
  2163. \r\n
  2164. \r\r\n\n\r
  2165. \r\r\n\n\r\n
  2166. /(\R)*(.)/s
  2167. \r\n
  2168. \r\r\n\n\r
  2169. \r\r\n\n\r\n
  2170. /((?>\r\n|\n|\x0b|\f|\r|\x85)*)(.)/s
  2171. \r\n
  2172. \r\r\n\n\r
  2173. \r\r\n\n\r\n
  2174. # -------------
  2175. /^abc$/B
  2176. /^abc$/Bm
  2177. /^(a)*+(\w)/
  2178. aaaaX
  2179. \= Expect no match
  2180. aaaa
  2181. /^(?:a)*+(\w)/
  2182. aaaaX
  2183. \= Expect no match
  2184. aaaa
  2185. /(a)++1234/IB
  2186. /([abc])++1234/I
  2187. /(?<=(abc)+)X/
  2188. /(^ab)/I
  2189. /(^ab)++/I
  2190. /(^ab|^)+/I
  2191. /(^ab|^)++/I
  2192. /(?:^ab)/I
  2193. /(?:^ab)++/I
  2194. /(?:^ab|^)+/I
  2195. /(?:^ab|^)++/I
  2196. /(.*ab)/I
  2197. /(.*ab)++/I
  2198. /(.*ab|.*)+/I
  2199. /(.*ab|.*)++/I
  2200. /(?:.*ab)/I
  2201. /(?:.*ab)++/I
  2202. /(?:.*ab|.*)+/I
  2203. /(?:.*ab|.*)++/I
  2204. /(?=a)[bcd]/I
  2205. /((?=a))[bcd]/I
  2206. /((?=a))+[bcd]/I
  2207. /((?=a))++[bcd]/I
  2208. /(?=a+)[bcd]/Ii
  2209. /(?=a+?)[bcd]/Ii
  2210. /(?=a++)[bcd]/Ii
  2211. /(?=a{3})[bcd]/Ii
  2212. /(abc)\1+/
  2213. # Perl doesn't get these right IMO (the 3rd is PCRE2-specific)
  2214. /(?1)(?:(b(*ACCEPT))){0}/
  2215. b
  2216. /(?1)(?:(b(*ACCEPT))){0}c/
  2217. bc
  2218. \= Expect no match
  2219. b
  2220. /(?1)(?:((*ACCEPT))){0}c/
  2221. c
  2222. c\=notempty
  2223. /^.*?(?(?=a)a|b(*THEN)c)/
  2224. \= Expect no match
  2225. ba
  2226. /^.*?(?(?=a)a|bc)/
  2227. ba
  2228. /^.*?(?(?=a)a(*THEN)b|c)/
  2229. \= Expect no match
  2230. ac
  2231. /^.*?(?(?=a)a(*THEN)b)c/
  2232. \= Expect no match
  2233. ac
  2234. /^.*?(a(*THEN)b)c/
  2235. \= Expect no match
  2236. aabc
  2237. /^.*? (?1) c (?(DEFINE)(a(*THEN)b))/x
  2238. aabc
  2239. /^.*?(a(*THEN)b|z)c/
  2240. aabc
  2241. /^.*?(z|a(*THEN)b)c/
  2242. aabc
  2243. # These are here because they are not Perl-compatible; the studying means the
  2244. # mark is not seen.
  2245. /(*MARK:A)(*SKIP:B)(C|X)/mark
  2246. C
  2247. \= Expect no match
  2248. D
  2249. /(*:A)A+(*SKIP:A)(B|Z)/mark
  2250. \= Expect no match
  2251. AAAC
  2252. # ----------------------------
  2253. "(?=a*(*ACCEPT)b)c"
  2254. c
  2255. c\=notempty
  2256. /(?1)c(?(DEFINE)((*ACCEPT)b))/
  2257. c
  2258. c\=notempty
  2259. /(?>(*ACCEPT)b)c/
  2260. c
  2261. \= Expect no match
  2262. c\=notempty
  2263. /(?:(?>(a)))+a%/allaftertext
  2264. %aa%
  2265. /(a)b|ac/allaftertext
  2266. ac\=ovector=1
  2267. /(a)(b)x|abc/allaftertext
  2268. abc\=ovector=2
  2269. /(a)bc|(a)(b)\2/
  2270. abc\=ovector=1
  2271. abc\=ovector=2
  2272. aba\=ovector=1
  2273. aba\=ovector=2
  2274. aba\=ovector=3
  2275. aba\=ovector=4
  2276. /(?(DEFINE)(a(?2)|b)(b(?1)|a))(?:(?1)|(?2))/I
  2277. /(a(?2)|b)(b(?1)|a)(?:(?1)|(?2))/I
  2278. /(a(?2)|b)(b(?1)|a)(?1)(?2)/I
  2279. /(abc)(?1)/I
  2280. /(?:(foo)|(bar)|(baz))X/allcaptures
  2281. bazfooX
  2282. foobazbarX
  2283. barfooX
  2284. bazX
  2285. foobarbazX
  2286. bazfooX\=ovector=0
  2287. bazfooX\=ovector=1
  2288. bazfooX\=ovector=2
  2289. bazfooX\=ovector=3
  2290. /(?=abc){3}abc/B
  2291. /(?=abc)+abc/B
  2292. /(?=abc)++abc/B
  2293. /(?=abc){0}xyz/B
  2294. /(?=(a))?./B
  2295. /(?=(a))??./B
  2296. /^(?=(a)){0}b(?1)/B
  2297. /(?(DEFINE)(a))?b(?1)/B
  2298. /^(?=(?1))?[az]([abc])d/B
  2299. /^(?!a){0}\w+/B
  2300. /(?<=(abc))?xyz/B
  2301. /[:a[:abc]b:]/B
  2302. /^(a(*:A)(d|e(*:B))z|aeq)/auto_callout
  2303. adz
  2304. aez
  2305. aeqwerty
  2306. /.(*F)/
  2307. \= Expect no match
  2308. abc\=ph
  2309. /\btype\b\W*?\btext\b\W*?\bjavascript\b/I
  2310. /\btype\b\W*?\btext\b\W*?\bjavascript\b|\burl\b\W*?\bshell:|<input\b.*?\btype\b\W*?\bimage\b|\bonkeyup\b\W*?\=/I
  2311. /a(*SKIP)c|b(*ACCEPT)|/I,aftertext
  2312. a
  2313. /a(*SKIP)c|b(*ACCEPT)cd(*ACCEPT)|x/I
  2314. ax
  2315. 'a*(*ACCEPT)b'aftertext
  2316. abc\=notempty_atstart
  2317. bbb\=notempty_atstart
  2318. \= Expect no match
  2319. \=notempty_atstart
  2320. /(*ACCEPT)a/I,aftertext
  2321. bax
  2322. /z(*ACCEPT)a/I,aftertext
  2323. baxzbx
  2324. /^(?>a+)(?>(z+))\w/B
  2325. aaaazzzzb
  2326. \= Expect no match
  2327. aazz
  2328. /(.)(\1|a(?2))/
  2329. bab
  2330. /\1|(.)(?R)\1/
  2331. cbbbc
  2332. /(.)((?(1)c|a)|a(?2))/
  2333. \= Expect no match
  2334. baa
  2335. /(?P<abn>(?P=abn)xxx)/B
  2336. /(a\1z)/B
  2337. /^a\x41z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2338. aAz
  2339. \= Expect no match
  2340. ax41z
  2341. /^a[m\x41]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2342. aAz
  2343. /^a\x1z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2344. ax1z
  2345. /^a\u0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2346. aAz
  2347. \= Expect no match
  2348. au0041z
  2349. /^a[m\u0041]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2350. aAz
  2351. /^a\u041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2352. au041z
  2353. \= Expect no match
  2354. aAz
  2355. /^a\U0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2356. aU0041z
  2357. \= Expect no match
  2358. aAz
  2359. /^\u{7a}/alt_bsux
  2360. u{7a}
  2361. \= Expect no match
  2362. zoo
  2363. /^\u{7a}/extra_alt_bsux
  2364. zoo
  2365. /\u{}/extra_alt_bsux
  2366. u{}
  2367. /\u{Q12}/extra_alt_bsux
  2368. --u{Q12}--
  2369. /\u{ 12}/extra_alt_bsux
  2370. --u{ 12}--
  2371. /\u{{3}}/extra_alt_bsux
  2372. --u{{{}--
  2373. /(?(?=c)c|d)++Y/B
  2374. /(?(?=c)c|d)*+Y/B
  2375. /a[\NB]c/
  2376. aNc
  2377. /a[B-\Nc]/
  2378. /a[B\Nc]/
  2379. /(a)(?2){0,1999}?(b)/
  2380. /(a)(?(DEFINE)(b))(?2){0,1999}?(?2)/
  2381. # This test, with something more complicated than individual letters, causes
  2382. # different behaviour in Perl. Perhaps it disables some optimization; no tag is
  2383. # passed back for the failures, whereas in PCRE2 there is a tag.
  2384. /(A|P)(*:A)(B|P) | (X|P)(X|P)(*:B)(Y|P)/x,mark
  2385. AABC
  2386. XXYZ
  2387. \= Expect no match
  2388. XAQQ
  2389. XAQQXZZ
  2390. AXQQQ
  2391. AXXQQQ
  2392. # Perl doesn't give marks for these, though it does if the alternatives are
  2393. # replaced by single letters.
  2394. /(b|q)(*:m)f|a(*:n)w/mark
  2395. aw
  2396. \= Expect no match
  2397. abc
  2398. /(q|b)(*:m)f|a(*:n)w/mark
  2399. aw
  2400. \= Expect no match
  2401. abc
  2402. # After a partial match, the behaviour is as for a failure.
  2403. /^a(*:X)bcde/mark
  2404. abc\=ps
  2405. # These are here because Perl doesn't return a mark, except for the first.
  2406. /(?=(*:x))(q|)/aftertext,mark
  2407. abc
  2408. /(?=(*:x))((*:y)q|)/aftertext,mark
  2409. abc
  2410. /(?=(*:x))(?:(*:y)q|)/aftertext,mark
  2411. abc
  2412. /(?=(*:x))(?>(*:y)q|)/aftertext,mark
  2413. abc
  2414. /(?=a(*:x))(?!a(*:y)c)/aftertext,mark
  2415. ab
  2416. /(?=a(*:x))(?=a(*:y)c|)/aftertext,mark
  2417. ab
  2418. /(..)\1/
  2419. ab\=ps
  2420. aba\=ps
  2421. abab\=ps
  2422. /(..)\1/i
  2423. ab\=ps
  2424. abA\=ps
  2425. aBAb\=ps
  2426. /(..)\1{2,}/
  2427. ab\=ps
  2428. aba\=ps
  2429. abab\=ps
  2430. ababa\=ps
  2431. ababab\=ps
  2432. ababab\=ph
  2433. abababa\=ps
  2434. abababa\=ph
  2435. /(..)\1{2,}/i
  2436. ab\=ps
  2437. aBa\=ps
  2438. aBAb\=ps
  2439. AbaBA\=ps
  2440. abABAb\=ps
  2441. aBAbaB\=ph
  2442. abABabA\=ps
  2443. abaBABa\=ph
  2444. /(..)\1{2,}?x/i
  2445. ab\=ps
  2446. abA\=ps
  2447. aBAb\=ps
  2448. abaBA\=ps
  2449. abAbaB\=ps
  2450. abaBabA\=ps
  2451. abAbABaBx\=ps
  2452. /^(..)\1/
  2453. aba\=ps
  2454. /^(..)\1{2,3}x/
  2455. aba\=ps
  2456. ababa\=ps
  2457. ababa\=ph
  2458. abababx
  2459. ababababx
  2460. /^(..)\1{2,3}?x/
  2461. aba\=ps
  2462. ababa\=ps
  2463. ababa\=ph
  2464. abababx
  2465. ababababx
  2466. /^(..)(\1{2,3})ab/
  2467. abababab
  2468. /^\R/
  2469. \r\=ps
  2470. \r\=ph
  2471. /^\R{2,3}x/
  2472. \r\=ps
  2473. \r\=ph
  2474. \r\r\=ps
  2475. \r\r\=ph
  2476. \r\r\r\=ps
  2477. \r\r\r\=ph
  2478. \r\rx
  2479. \r\r\rx
  2480. /^\R{2,3}?x/
  2481. \r\=ps
  2482. \r\=ph
  2483. \r\r\=ps
  2484. \r\r\=ph
  2485. \r\r\r\=ps
  2486. \r\r\r\=ph
  2487. \r\rx
  2488. \r\r\rx
  2489. /^\R?x/
  2490. \r\=ps
  2491. \r\=ph
  2492. x
  2493. \rx
  2494. /^\R+x/
  2495. \r\=ps
  2496. \r\=ph
  2497. \r\n\=ps
  2498. \r\n\=ph
  2499. \rx
  2500. /^a$/newline=crlf
  2501. a\r\=ps
  2502. a\r\=ph
  2503. /^a$/m,newline=crlf
  2504. a\r\=ps
  2505. a\r\=ph
  2506. /^(a$|a\r)/newline=crlf
  2507. a\r\=ps
  2508. a\r\=ph
  2509. /^(a$|a\r)/m,newline=crlf
  2510. a\r\=ps
  2511. a\r\=ph
  2512. /./newline=crlf
  2513. \r\=ps
  2514. \r\=ph
  2515. /.{2,3}/newline=crlf
  2516. \r\=ps
  2517. \r\=ph
  2518. \r\r\=ps
  2519. \r\r\=ph
  2520. \r\r\r\=ps
  2521. \r\r\r\=ph
  2522. /.{2,3}?/newline=crlf
  2523. \r\=ps
  2524. \r\=ph
  2525. \r\r\=ps
  2526. \r\r\=ph
  2527. \r\r\r\=ps
  2528. \r\r\r\=ph
  2529. "AB(C(D))(E(F))?(?(?=\2)(?=\4))"
  2530. ABCDGHI\=ovector=01
  2531. # These are all run as real matches in test 1; here we are just checking the
  2532. # settings of the anchored and startline bits.
  2533. /(?>.*?a)(?<=ba)/I
  2534. /(?:.*?a)(?<=ba)/I
  2535. /.*?a(*PRUNE)b/I
  2536. /.*?a(*PRUNE)b/Is
  2537. /^a(*PRUNE)b/Is
  2538. /.*?a(*SKIP)b/I
  2539. /(?>.*?a)b/Is
  2540. /(?>.*?a)b/I
  2541. /(?>^a)b/Is
  2542. /(?>.*?)(?<=(abcd)|(wxyz))/I
  2543. /(?>.*)(?<=(abcd)|(wxyz))/I
  2544. "(?>.*)foo"I
  2545. "(?>.*?)foo"I
  2546. /(?>^abc)/Im
  2547. /(?>.*abc)/Im
  2548. /(?:.*abc)/Im
  2549. /(?:(a)+(?C1)bb|aa(?C2)b)/
  2550. aab\=callout_capture
  2551. /(?:(a)++(?C1)bb|aa(?C2)b)/
  2552. aab\=callout_capture
  2553. /(?:(?>(a))(?C1)bb|aa(?C2)b)/
  2554. aab\=callout_capture
  2555. /(?:(?1)(?C1)x|ab(?C2))((a)){0}/
  2556. aab\=callout_capture
  2557. /(?1)(?C1)((a)(?C2)){0}/
  2558. aab\=callout_capture
  2559. /(?:(a)+(?C1)bb|aa(?C2)b)++/
  2560. aab\=callout_capture
  2561. aab\=callout_capture,ovector=1
  2562. /(ab)x|ab/
  2563. ab\=ovector=0
  2564. ab\=ovector=1
  2565. /(?<=123)(*MARK:xx)abc/mark
  2566. xxxx123a\=ph
  2567. xxxx123a\=ps
  2568. /123\Kabc/startchar
  2569. xxxx123a\=ph
  2570. xxxx123a\=ps
  2571. /^(?(?=a)aa|bb)/auto_callout
  2572. bb
  2573. /(?C1)^(?C2)(?(?C99)(?=(?C3)a(?C4))(?C5)a(?C6)a(?C7)|(?C8)b(?C9)b(?C10))(?C11)/
  2574. bb
  2575. # Perl seems to have a bug with this one.
  2576. /aaaaa(*COMMIT)(*PRUNE)b|a+c/
  2577. aaaaaac
  2578. # Here are some that Perl treats differently because of the way it handles
  2579. # backtracking verbs.
  2580. /(?!a(*COMMIT)b)ac|ad/
  2581. ac
  2582. ad
  2583. /^(?!a(*THEN)b|ac)../
  2584. ad
  2585. \= Expect no match
  2586. ac
  2587. /^(?=a(*THEN)b|ac)/
  2588. ac
  2589. /\A.*?(?:a|b(*THEN)c)/
  2590. ba
  2591. /\A.*?(?:a|b(*THEN)c)++/
  2592. ba
  2593. /\A.*?(?:a|b(*THEN)c|d)/
  2594. ba
  2595. /(?:(a(*MARK:X)a+(*SKIP:X)b)){0}(?:(?1)|aac)/
  2596. aac
  2597. /\A.*?(a|b(*THEN)c)/
  2598. ba
  2599. /^(A(*THEN)B|A(*THEN)D)/
  2600. AD
  2601. /(?!b(*THEN)a)bn|bnn/
  2602. bnn
  2603. /(?(?=b(*SKIP)a)bn|bnn)/
  2604. bnn
  2605. /(?=b(*THEN)a|)bn|bnn/
  2606. bnn
  2607. # This test causes a segfault with Perl 5.18.0
  2608. /^(?=(a)){0}b(?1)/
  2609. backgammon
  2610. /(?|(?<n>f)|(?<n>b))/I,dupnames
  2611. /(?<a>abc)(?<a>z)\k<a>()/IB,dupnames
  2612. /a*[bcd]/B
  2613. /[bcd]*a/B
  2614. # A complete set of tests for auto-possessification of character types, but
  2615. # omitting \C because it might be disabled (it has its own tests).
  2616. /\D+\D \D+\d \D+\S \D+\s \D+\W \D+\w \D+. \D+\R \D+\H \D+\h \D+\V \D+\v \D+\Z \D+\z \D+$/Bx
  2617. /\d+\D \d+\d \d+\S \d+\s \d+\W \d+\w \d+. \d+\R \d+\H \d+\h \d+\V \d+\v \d+\Z \d+\z \d+$/Bx
  2618. /\S+\D \S+\d \S+\S \S+\s \S+\W \S+\w \S+. \S+\R \S+\H \S+\h \S+\V \S+\v \S+\Z \S+\z \S+$/Bx
  2619. /\s+\D \s+\d \s+\S \s+\s \s+\W \s+\w \s+. \s+\R \s+\H \s+\h \s+\V \s+\v \s+\Z \s+\z \s+$/Bx
  2620. /\W+\D \W+\d \W+\S \W+\s \W+\W \W+\w \W+. \W+\R \W+\H \W+\h \W+\V \W+\v \W+\Z \W+\z \W+$/Bx
  2621. /\w+\D \w+\d \w+\S \w+\s \w+\W \w+\w \w+. \w+\R \w+\H \w+\h \w+\V \w+\v \w+\Z \w+\z \w+$/Bx
  2622. /\R+\D \R+\d \R+\S \R+\s \R+\W \R+\w \R+. \R+\R \R+\H \R+\h \R+\V \R+\v \R+\Z \R+\z \R+$/Bx
  2623. /\H+\D \H+\d \H+\S \H+\s \H+\W \H+\w \H+. \H+\R \H+\H \H+\h \H+\V \H+\v \H+\Z \H+\z \H+$/Bx
  2624. /\h+\D \h+\d \h+\S \h+\s \h+\W \h+\w \h+. \h+\R \h+\H \h+\h \h+\V \h+\v \h+\Z \h+\z \h+$/Bx
  2625. /\V+\D \V+\d \V+\S \V+\s \V+\W \V+\w \V+. \V+\R \V+\H \V+\h \V+\V \V+\v \V+\Z \V+\z \V+$/Bx
  2626. /\v+\D \v+\d \v+\S \v+\s \v+\W \v+\w \v+. \v+\R \v+\H \v+\h \v+\V \v+\v \v+\Z \v+\z \v+$/Bx
  2627. / a+\D a+\d a+\S a+\s a+\W a+\w a+. a+\R a+\H a+\h a+\V a+\v a+\Z a+\z a+$/Bx
  2628. /\n+\D \n+\d \n+\S \n+\s \n+\W \n+\w \n+. \n+\R \n+\H \n+\h \n+\V \n+\v \n+\Z \n+\z \n+$/Bx
  2629. / .+\D .+\d .+\S .+\s .+\W .+\w .+. .+\R .+\H .+\h .+\V .+\v .+\Z .+\z .+$/Bx
  2630. / .+\D .+\d .+\S .+\s .+\W .+\w .+. .+\R .+\H .+\h .+\V .+\v .+\Z .+\z .+$/Bsx
  2631. / \D+$ \d+$ \S+$ \s+$ \W+$ \w+$ \R+$ \H+$ \h+$ \V+$ \v+$ a+$ \n+$ .+$ .+$/Bmx
  2632. /(?=a+)a(a+)++a/B
  2633. /a+(bb|cc)a+(?:bb|cc)a+(?>bb|cc)a+(?:bb|cc)+a+(aa)a+(?:bb|aa)/B
  2634. /a+(bb|cc)?#a+(?:bb|cc)??#a+(?:bb|cc)?+#a+(?:bb|cc)*#a+(bb|cc)?a#a+(?:aa)?/B
  2635. /a+(?:bb)?a#a+(?:|||)#a+(?:|b)a#a+(?:|||)?a/B
  2636. /[ab]*/B
  2637. aaaa
  2638. /[ab]*?/B
  2639. aaaa
  2640. /[ab]?/B
  2641. aaaa
  2642. /[ab]??/B
  2643. aaaa
  2644. /[ab]+/B
  2645. aaaa
  2646. /[ab]+?/B
  2647. aaaa
  2648. /[ab]{2,3}/B
  2649. aaaa
  2650. /[ab]{2,3}?/B
  2651. aaaa
  2652. /[ab]{2,}/B
  2653. aaaa
  2654. /[ab]{2,}?/B
  2655. aaaa
  2656. /\d+\s{0,5}=\s*\S?=\w{0,4}\W*/B
  2657. /[a-d]{5,12}[e-z0-9]*#[^a-z]+[b-y]*a[2-7]?[^0-9a-z]+/B
  2658. /[a-z]*\s#[ \t]?\S#[a-c]*\S#[C-G]+?\d#[4-8]*\D#[4-9,]*\D#[!$]{0,5}\w#[M-Xf-l]+\W#[a-c,]?\W/B
  2659. /a+(aa|bb)*c#a*(bb|cc)*a#a?(bb|cc)*d#[a-f]*(g|hh)*f/B
  2660. /[a-f]*(g|hh|i)*i#[a-x]{4,}(y{0,6})*y#[a-k]+(ll|mm)+n/B
  2661. /[a-f]*(?>gg|hh)+#[a-f]*(?>gg|hh)?#[a-f]*(?>gg|hh)*a#[a-f]*(?>gg|hh)*h/B
  2662. /[a-c]*d/IB
  2663. /[a-c]+d/IB
  2664. /[a-c]?d/IB
  2665. /[a-c]{4,6}d/IB
  2666. /[a-c]{0,6}d/IB
  2667. # End of special auto-possessive tests
  2668. /^A\o{1239}B/
  2669. A\123B
  2670. /^A\oB/
  2671. /^A\x{zz}B/
  2672. /^A\x{12Z/
  2673. /^A\x{/
  2674. /[ab]++/B,no_auto_possess
  2675. /[^ab]*+/B,no_auto_possess
  2676. /a{4}+/B,no_auto_possess
  2677. /a{4}+/Bi,no_auto_possess
  2678. /[a-[:digit:]]+/
  2679. /[A-[:digit:]]+/
  2680. /[a-[.xxx.]]+/
  2681. /[a-[=xxx=]]+/
  2682. /[a-[!xxx!]]+/
  2683. /[A-[!xxx!]]+/
  2684. A]]]
  2685. /[a-\d]+/
  2686. /(?<0abc>xx)/
  2687. /(?&1abc)xx(?<1abc>y)/
  2688. /(?<ab-cd>xx)/
  2689. /(?'0abc'xx)/
  2690. /(?P<0abc>xx)/
  2691. /\k<5ghj>/
  2692. /\k'5ghj'/
  2693. /\k{2fgh}/
  2694. /(?P=8yuki)/
  2695. /\g{4df}/
  2696. /(?&1abc)xx(?<1abc>y)/
  2697. /(?P>1abc)xx(?<1abc>y)/
  2698. /\g'3gh'/
  2699. /\g<5fg>/
  2700. /(?(<4gh>)abc)/
  2701. /(?('4gh')abc)/
  2702. /(?(4gh)abc)/
  2703. /(?(R&6yh)abc)/
  2704. /(((a\2)|(a*)\g<-1>))*a?/B
  2705. # Test the ugly "start or end of word" compatibility syntax.
  2706. /[[:<:]]red[[:>:]]/B
  2707. little red riding hood
  2708. a /red/ thing
  2709. red is a colour
  2710. put it all on red
  2711. \= Expect no match
  2712. no reduction
  2713. Alfred Winifred
  2714. /[a[:<:]] should give error/
  2715. /(?=ab\K)/aftertext,allow_lookaround_bsk
  2716. abcd\=startchar
  2717. /abcd/newline=lf,firstline
  2718. \= Expect no match
  2719. xx\nxabcd
  2720. # Test stack guard external calls.
  2721. /(((a)))/stackguard=1
  2722. /(((a)))/stackguard=2
  2723. /(((a)))/stackguard=3
  2724. /(((((a)))))/
  2725. # End stack guard tests
  2726. /^\w+(?>\s*)(?<=\w)/B
  2727. /\othing/
  2728. /\o{}/
  2729. /\o{whatever}/
  2730. /\xthing/
  2731. /\x{}/
  2732. /\x{whatever}/
  2733. /A\8B/
  2734. /A\9B/
  2735. # This one is here because Perl fails to match "12" for this pattern when the $
  2736. # is present.
  2737. /^(?(?=abc)\w{3}:|\d\d)$/
  2738. abc:
  2739. 12
  2740. \= Expect no match
  2741. 123
  2742. xyz
  2743. # Perl gets this one wrong, giving "a" as the after text for ca and failing to
  2744. # match for cd.
  2745. /(?(?=ab)ab)/aftertext
  2746. abxxx
  2747. ca
  2748. cd
  2749. # This should test both paths for processing OP_RECURSE.
  2750. /(?(R)a+|(?R)b)/
  2751. aaaabcde
  2752. aaaabcde\=ovector=100
  2753. /a*?b*?/
  2754. ab
  2755. /(*NOTEMPTY)a*?b*?/
  2756. ab
  2757. ba
  2758. cb
  2759. /(*NOTEMPTY_ATSTART)a*?b*?/aftertext
  2760. ab
  2761. cdab
  2762. /(?(VERSION>=10.0)yes|no)/I
  2763. yesno
  2764. /(?(VERSION>=10.04)yes|no)/
  2765. yesno
  2766. /(?(VERSION=8)yes){3}/BI,aftertext
  2767. yesno
  2768. /(?(VERSION=8)yes|no){3}/I
  2769. yesnononoyes
  2770. \= Expect no match
  2771. yesno
  2772. /(?:(?<VERSION>abc)|xyz)(?(VERSION)yes|no)/I
  2773. abcyes
  2774. xyzno
  2775. \= Expect no match
  2776. abcno
  2777. xyzyes
  2778. /(?(VERSION<10)yes|no)/
  2779. /(?(VERSION>10)yes|no)/
  2780. /(?(VERSION>=10.0.0)yes|no)/
  2781. /(?(VERSION=10.101)yes|no)/
  2782. /abcd/I
  2783. /abcd/I,no_start_optimize
  2784. /(|ab)*?d/I
  2785. abd
  2786. xyd
  2787. /(|ab)*?d/I,no_start_optimize
  2788. abd
  2789. xyd
  2790. /\k<A>*(?<A>aa)(?<A>bb)/match_unset_backref,dupnames
  2791. aabb
  2792. /(((((a)))))/parens_nest_limit=2
  2793. /abc/replace=XYZ
  2794. 123123
  2795. 123abc123
  2796. 123abc123abc123
  2797. 123123\=zero_terminate
  2798. 123abc123\=zero_terminate
  2799. 123abc123abc123\=zero_terminate
  2800. /abc/g,replace=XYZ
  2801. 123abc123
  2802. 123abc123abc123
  2803. /abc/replace=X$$Z
  2804. 123abc123
  2805. /abc/g,replace=X$$Z
  2806. 123abc123abc123
  2807. /a(b)c(d)e/replace=X$1Y${2}Z
  2808. "abcde"
  2809. /a(b)c(d)e/replace=X$1Y${2}Z,global
  2810. "abcde-abcde"
  2811. /a(?<ONE>b)c(?<TWO>d)e/replace=X$ONE+${TWO}Z
  2812. "abcde"
  2813. /a(?<ONE>b)c(?<TWO>d)e/g,replace=X$ONE+${TWO}Z
  2814. "abcde-abcde-"
  2815. /abc/replace=a$++
  2816. 123abc
  2817. /abc/replace=a$bad
  2818. 123abc
  2819. /abc/replace=a${A234567890123456789_123456789012}z
  2820. 123abc
  2821. /abc/replace=a${A23456789012345678901234567890123}z
  2822. 123abc
  2823. /abc/replace=a${bcd
  2824. 123abc
  2825. /abc/replace=a${b+d}z
  2826. 123abc
  2827. /abc/replace=[10]XYZ
  2828. 123abc123
  2829. /abc/replace=[9]XYZ
  2830. 123abc123
  2831. /abc/replace=xyz
  2832. 1abc2\=partial_hard
  2833. /abc/replace=xyz
  2834. 123abc456
  2835. 123abc456\=replace=pqr
  2836. 123abc456abc789
  2837. 123abc456abc789\=g
  2838. /(?<=abc)(|def)/g,replace=<$0>
  2839. 123abcxyzabcdef789abcpqr
  2840. /./replace=$0
  2841. a
  2842. /(.)(.)/replace=$2+$1
  2843. abc
  2844. /(?<A>.)(?<B>.)/replace=$B+$A
  2845. abc
  2846. /(.)(.)/g,replace=$2$1
  2847. abcdefgh
  2848. /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=${*MARK}
  2849. apple lemon blackberry
  2850. apple strudel
  2851. fruitless
  2852. /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/replace=${*MARK} sauce,
  2853. apple lemon blackberry
  2854. /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARK>
  2855. apple lemon blackberry
  2856. apple strudel
  2857. fruitless
  2858. /(*:pear)apple/g,replace=${*MARKING}
  2859. apple lemon blackberry
  2860. /(*:pear)apple/g,replace=${*MARK-time
  2861. apple lemon blackberry
  2862. /(*:pear)apple/g,replace=${*mark}
  2863. apple lemon blackberry
  2864. /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARKET>
  2865. apple lemon blackberry
  2866. /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[22]${*MARK}
  2867. apple lemon blackberry
  2868. apple lemon blackberry\=substitute_overflow_length
  2869. /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[23]${*MARK}
  2870. apple lemon blackberry
  2871. /abc/
  2872. 123abc123\=replace=[9]XYZ
  2873. 123abc123\=substitute_overflow_length,replace=[9]XYZ
  2874. 123abc123\=substitute_overflow_length,replace=[6]XYZ
  2875. 123abc123\=substitute_overflow_length,replace=[1]XYZ
  2876. 123abc123\=substitute_overflow_length,replace=[0]XYZ
  2877. /a(b)c/
  2878. 123abc123\=replace=[9]x$1z
  2879. 123abc123\=substitute_overflow_length,replace=[9]x$1z
  2880. 123abc123\=substitute_overflow_length,replace=[6]x$1z
  2881. 123abc123\=substitute_overflow_length,replace=[1]x$1z
  2882. 123abc123\=substitute_overflow_length,replace=[0]x$1z
  2883. "((?=(?(?=(?(?=(?(?=()))))))))"
  2884. a
  2885. "(?(?=)==)(((((((((?=)))))))))"
  2886. \= Expect no match
  2887. a
  2888. /(a)(b)|(c)/
  2889. XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
  2890. /x(?=ab\K)/allow_lookaround_bsk
  2891. xab\=get=0
  2892. xab\=copy=0
  2893. xab\=getall
  2894. /(?<A>a)|(?<A>b)/dupnames
  2895. a\=ovector=1,copy=A,get=A,get=2
  2896. a\=ovector=2,copy=A,get=A,get=2
  2897. b\=ovector=2,copy=A,get=A,get=2
  2898. /a(b)c(d)/
  2899. abc\=ph,copy=0,copy=1,getall
  2900. /^abc/info
  2901. /^abc/info,no_dotstar_anchor
  2902. /.*\d/info,auto_callout
  2903. \= Expect no match
  2904. aaa
  2905. /.*\d/info,no_dotstar_anchor,auto_callout
  2906. \= Expect no match
  2907. aaa
  2908. /.*\d/dotall,info
  2909. /.*\d/dotall,no_dotstar_anchor,info
  2910. /(*NO_DOTSTAR_ANCHOR)(?s).*\d/info
  2911. '^(?:(a)|b)(?(1)A|B)'
  2912. aA123\=ovector=1
  2913. aA123\=ovector=2
  2914. '^(?:(?<AA>a)|b)(?(<AA>)A|B)'
  2915. aA123\=ovector=1
  2916. aA123\=ovector=2
  2917. '^(?<AA>)(?:(?<AA>a)|b)(?(<AA>)A|B)'dupnames
  2918. aA123\=ovector=1
  2919. aA123\=ovector=2
  2920. aA123\=ovector=3
  2921. '^(?:(?<AA>X)|)(?:(?<AA>a)|b)\k{AA}'dupnames
  2922. aa123\=ovector=1
  2923. aa123\=ovector=2
  2924. aa123\=ovector=3
  2925. /(?<N111>(?J)(?<N111>1(111111)11|)1|1|)(?(<N111>)1)/
  2926. /(?<N>(?J)(?<N>))(?-J)\k<N>/
  2927. # Quantifiers are not allowed on condition assertions, but are otherwise
  2928. # OK in conditions.
  2929. /(?(?=0)?)+/
  2930. /(?(?=0)(?=00)?00765)/
  2931. 00765
  2932. /(?(?=0)(?=00)?00765|(?!3).56)/
  2933. 00765
  2934. 456
  2935. \= Expect no match
  2936. 356
  2937. '^(a)*+(\w)'
  2938. g
  2939. g\=ovector=1
  2940. '^(?:a)*+(\w)'
  2941. g
  2942. g\=ovector=1
  2943. # These two pattern showeds up compile-time bugs
  2944. "((?2){0,1999}())?"
  2945. /((?+1)(\1))/B
  2946. # Callouts with string arguments
  2947. /a(?C"/
  2948. /a(?C"a/
  2949. /a(?C"a"/
  2950. /a(?C"a"bcde(?C"b")xyz/
  2951. /a(?C"a)b""c")/B
  2952. /ab(?C" any text with spaces ")cde/B
  2953. abcde
  2954. 12abcde
  2955. /^a(b)c(?C1)def/
  2956. abcdef
  2957. /^a(b)c(?C"AB")def/
  2958. abcdef
  2959. /^a(b)c(?C1)def/
  2960. abcdef\=callout_capture
  2961. /^a(b)c(?C{AB})def/B
  2962. abcdef\=callout_capture
  2963. /(?C`a``b`)(?C'a''b')(?C"a""b")(?C^a^^b^)(?C%a%%b%)(?C#a##b#)(?C$a$$b$)(?C{a}}b})/B,callout_info
  2964. /(?:a(?C`code`)){3}/B
  2965. /^(?(?C25)(?=abc)abcd|xyz)/B,callout_info
  2966. abcdefg
  2967. xyz123
  2968. /^(?(?C$abc$)(?=abc)abcd|xyz)/B
  2969. abcdefg
  2970. xyz123
  2971. /^ab(?C'first')cd(?C"second")ef/
  2972. abcdefg
  2973. /(?:a(?C`code`)){3}X/
  2974. aaaXY
  2975. # Binary zero in callout string
  2976. # a ( ? C ' x z ' ) b
  2977. / 61 28 3f 43 27 78 00 7a 27 29 62/hex,callout_info
  2978. abcdefgh
  2979. /(?(?!)^)/
  2980. /(?(?!)a|b)/
  2981. bbb
  2982. \= Expect no match
  2983. aaa
  2984. # JIT gives a different error message for the infinite recursion
  2985. "(*NO_JIT)((?2)+)((?1)){"
  2986. abcd{
  2987. # Perl fails to diagnose the absence of an assertion
  2988. "(?(?<E>.*!.*)?)"
  2989. "X((?2)()*+){2}+"B
  2990. "X((?2)()*+){2}"B
  2991. /(?<=\bABQ(3(?-7)))/
  2992. /(?<=\bABQ(3(?+7)))/
  2993. ";(?<=()((?3))((?2)))"
  2994. # Perl loops on this (PCRE2 used to!)
  2995. /(?<=\Ka)/g,aftertext,allow_lookaround_bsk
  2996. aaaaa
  2997. /(?<=\Ka)/altglobal,aftertext,allow_lookaround_bsk
  2998. aaaaa
  2999. /((?2){73}(?2))((?1))/info
  3000. /abc/
  3001. \= Expect no match
  3002. \[9x!xxx(]{9999}
  3003. /(abc)*/
  3004. \[abc]{5}
  3005. /^/gm
  3006. \n\n\n
  3007. /^/gm,alt_circumflex
  3008. \n\n\n
  3009. /((((((((x))))))))\81/
  3010. xx1
  3011. /((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\80/
  3012. xx
  3013. /\80/
  3014. /A\8B\9C/
  3015. A8B9C
  3016. /(?x:((?'a')) # comment (with parentheses) and | vertical
  3017. (?-x:#not a comment (?'b')) # this is a comment ()
  3018. (?'c')) # not a comment (?'d')/info
  3019. /(?|(?'a')(2)(?'b')|(?'a')(?'a')(3))/I,dupnames
  3020. A23B
  3021. B32A
  3022. # These are some patterns that used to cause buffer overflows or other errors
  3023. # while compiling.
  3024. /.((?2)(?R)|\1|$)()/B
  3025. /.((?3)(?R)()(?2)|\1|$)()/B
  3026. /(\9*+(?2);\3++()2|)++{/
  3027. /\V\x85\9*+((?2)\3++()2)*:2/
  3028. /(((?(R)){0,2}) (?'x'((?'R')((?'R')))))/dupnames
  3029. /(((?(X)){0,2}) (?'x'((?'X')((?'X')))))/dupnames
  3030. /(((?(R)){0,2}) (?'x'((?'X')((?'R')))))/
  3031. "(?J)(?'d'(?'d'\g{d}))"
  3032. "(?=!((?2)(?))({8(?<=(?1){29}8bbbb\x16\xd\xc6^($(\xa9H4){4}h}?1)B))\x15')"
  3033. /A(?'')Z/
  3034. "(?J:(?|(?'R')(\k'R')|((?'R'))))"
  3035. /(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/
  3036. /^(?:(?(1)x|)+)+$()/B
  3037. /[[:>:]](?<)/
  3038. /((?x)(*:0))#(?'/
  3039. /(?C$[$)(?<]/
  3040. /(?C$)$)(?<]/
  3041. /(?(R))*+/B
  3042. abcd
  3043. /((?x)(?#))#(?'/
  3044. /((?x)(?#))#(?'abc')/I
  3045. /[[:\\](?<[::]/
  3046. /[[:\\](?'abc')[a:]/I
  3047. "[[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[:::::::::::::::::[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[[[:::E[[[:[:[[:[:::[[:::E[[[:[:[[:'[:::::E[[[:[::::::[[[:[[[[[[[::E[[[:[::::::[[[:[[[[[[[[:[[::[::::[[:::::::[[:[[[[[[[:[[::[:[[:[~"
  3048. /()(?(R)0)*+/B
  3049. /(?R-:(?</
  3050. /(?R-:(?<)/
  3051. /(?(?C{\Q})(?!(?'/
  3052. /(?(?C{\Q})(?!(?'abc')))/I
  3053. /(?1){3918}(((((0(\k'R'))))(?J)(?'R'(?'R'\3){99})))/I
  3054. /(?|(aaa)|(b))\g{1}/I
  3055. /(?|(aaa)|(b))(?1)/I
  3056. /(?|(aaa)|(b))/I
  3057. /(?|(?'a'aaa)|(?'a'b))\k'a'/I
  3058. /(?|(?'a'aaa)|(?'a'b))(?'a'cccc)\k'a'/I,dupnames
  3059. /ab{3cd/
  3060. ab{3cd
  3061. /ab{3,cd/
  3062. ab{3,cd
  3063. /ab{3,4a}cd/
  3064. ab{3,4a}cd
  3065. /{4,5a}bc/
  3066. {4,5a}bc
  3067. /\x0{ab}/
  3068. \0{ab}
  3069. /^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
  3070. ababababbbabZXXXX
  3071. /.*?a(*PRUNE)b/
  3072. aab
  3073. /.*?a(*PRUNE)b/s
  3074. aab
  3075. /^a(*PRUNE)b/s
  3076. \= Expect no match
  3077. aab
  3078. /.*?a(*SKIP)b/
  3079. aab
  3080. /(?(8000000000/
  3081. /((?(R8000000000)))/
  3082. /0(?0)|(1)(*THEN)(*SKIP:0)(*FAIL)/
  3083. \= Expect no match
  3084. 01
  3085. /(?(1)()\983040\2)/
  3086. /(*LIMIT_MATCH=)abc/
  3087. /(*CRLF)(*LIMIT_MATCH=)abc/
  3088. /(?:ab)?(?:ab)(?:ab)/
  3089. abab
  3090. ababab
  3091. \= Expect no match
  3092. aba
  3093. /((*MARK:A))++a(*SKIP:B)b/
  3094. \= Expect no match
  3095. aacb
  3096. /(*MARK:a\zb)z/alt_verbnames
  3097. /(*:ab\t(d\)c)xxx/
  3098. /(*:ab\t(d\)c)xxx/alt_verbnames,mark
  3099. cxxxz
  3100. /(*:A\Qxx)x\EB)x/alt_verbnames,mark
  3101. x
  3102. /(*:A\ExxxB)x/alt_verbnames,mark
  3103. x
  3104. /(*: A \ and #comment
  3105. \ B)x/x,alt_verbnames,mark
  3106. x
  3107. /(*: A \ and #comment
  3108. \ B)x/alt_verbnames,mark
  3109. x
  3110. /(*: A \ and #comment
  3111. \ B)x/x,mark
  3112. x
  3113. /(*: A \ and #comment
  3114. \ B)x/mark
  3115. x
  3116. /(*:A
  3117. B)x/alt_verbnames,mark
  3118. x
  3119. /(*:abc\Qpqr)/alt_verbnames
  3120. /abc/use_offset_limit
  3121. 1234abcde\=offset_limit=100
  3122. 1234abcde\=offset_limit=9
  3123. 1234abcde\=offset_limit=4
  3124. 1234abcde\=offset_limit=4,offset=4
  3125. \= Expect no match
  3126. 1234abcde\=offset_limit=4,offset=5
  3127. 1234abcde\=offset_limit=3
  3128. /(?<=abc)/use_offset_limit
  3129. 1234abc\=offset_limit=7
  3130. \= Expect no match
  3131. 1234abc\=offset_limit=6
  3132. /A/g,replace=-,use_offset_limit
  3133. XAXAXAXAXA\=offset_limit=4
  3134. /abc/
  3135. \= Expect error
  3136. 1234abcde\=offset_limit=4
  3137. /^\w/m,use_offset_limit
  3138. \n..\naa\=offset_limit=3
  3139. \n..\naa\=offset_limit=4
  3140. /abcd/null_context
  3141. abcd\=null_context
  3142. \= Expect error - not allowed together
  3143. abcd\=null_context,find_limits
  3144. abcd\=allusedtext,startchar
  3145. /abcd/replace=w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$),substitute_extended
  3146. abcd
  3147. /abcd/replace=w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$),substitute_extended,substitute_literal
  3148. >>abcd<<
  3149. /abcd/g,replace=\$1$2\,substitute_literal
  3150. XabcdYabcdZ
  3151. /a(bc)(DE)/replace=a\u$1\U$1\E$1\l$2\L$2\Eab\Uab\LYZ\EDone,substitute_extended
  3152. abcDE
  3153. /abcd/replace=xy\kz,substitute_extended
  3154. abcd
  3155. /a(?:(b)|(c))/substitute_extended,replace=X${1:+1:-1}X${2:+2:-2}
  3156. ab
  3157. ac
  3158. ab\=replace=${1:+$1\:$1:$2}
  3159. ac\=replace=${1:+$1\:$1:$2}
  3160. >>ac<<\=replace=${1:+$1\:$1:$2},substitute_literal
  3161. /a(?:(b)|(c))/substitute_extended,replace=X${1:-1:-1}X${2:-2:-2}
  3162. ab
  3163. ac
  3164. /(a)/substitute_extended,replace=>${1:+\Q$1:{}$$\E+\U$1}<
  3165. a
  3166. /X(b)Y/substitute_extended
  3167. XbY\=replace=x${1:+$1\U$1}y
  3168. XbY\=replace=\Ux${1:+$1$1}y
  3169. /a/substitute_extended,replace=${*MARK:+a:b}
  3170. a
  3171. /(abcd)/replace=${1:+xy\kz},substitute_extended
  3172. abcd
  3173. /(abcd)/
  3174. abcd\=replace=${1:+xy\kz},substitute_extended
  3175. /abcd/substitute_extended,replace=>$1<
  3176. abcd
  3177. /abcd/substitute_extended,replace=>xxx${xyz}<<<
  3178. abcd
  3179. /(?J)(?:(?<A>a)|(?<A>b))/replace=<$A>
  3180. [a]
  3181. [b]
  3182. \= Expect error
  3183. (a)\=ovector=1
  3184. /(a)|(b)/replace=<$1>
  3185. \= Expect error
  3186. b
  3187. /(aa)(BB)/substitute_extended,replace=\U$1\L$2\E$1..\U$1\l$2$1
  3188. aaBB
  3189. /abcd/replace=wxyz,substitute_matched
  3190. abcd
  3191. pqrs
  3192. /abcd/g
  3193. >abcd1234abcd5678<\=replace=wxyz,substitute_matched
  3194. /^(o(\1{72}{\"{\\{00000059079}\d*){74}}){19}/I
  3195. /((p(?'K/
  3196. /((p(?'K/no_auto_capture
  3197. /abc/replace=A$3123456789Z
  3198. abc
  3199. /(?<!a{65535}a{5})x/I
  3200. /(?<!a{65535})x/I
  3201. /(?=a\K)/replace=z,allow_lookaround_bsk
  3202. BaCaD
  3203. /(?<=\K.)/g,replace=-,allow_lookaround_bsk
  3204. ab
  3205. /(?'abcdefghijklmnopqrstuvwxyzABCDEFG'toolong)/
  3206. /(?'abcdefghijklmnopqrstuvwxyzABCDEF'justright)/
  3207. # These two use zero-termination
  3208. /abcd/max_pattern_length=3
  3209. /abc/max_pattern_length=3
  3210. # These two, being hex, pass the length
  3211. /abcdefab/hex,max_pattern_length=3
  3212. /abcdef/hex,max_pattern_length=3
  3213. # These patterns used to take a long time to compile
  3214. "(.*)
  3215. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3216. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3217. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
  3218. "(?<=a()
  3219. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3220. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3221. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3222. a)"xI
  3223. "(?|()|())(.*)
  3224. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3225. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3226. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
  3227. "(?|()|())(?<=a()
  3228. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3229. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3230. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3231. a)"xI
  3232. # Test the use of malloc for caching group information when there are more
  3233. # groups than fit into the on-stack workspace.
  3234. /\[()]{1024}/I,expand
  3235. # Test minlength capped at 65535
  3236. /(A{65000})\1{65000}/I
  3237. # Test group scans when numbers are not unique
  3238. /(?|()+|(a)+)/BI
  3239. /(?|(a)+|()+)/BI
  3240. /(?|()|(a))/BI
  3241. /(?|(a)|())/BI
  3242. # Test CRLF handling in empty string substitutions
  3243. /^$/gm,newline=anycrlf,replace=-
  3244. X\r\n\r\nY
  3245. /^$/gm,newline=crlf,replace=-
  3246. X\r\n\r\nY
  3247. /^$/gm,newline=any,replace=-
  3248. X\r\n\r\nY
  3249. "(*ANYCRLF)(?m)^(.*[^0-9\r\n].*|)$"g,replace=NaN
  3250. 15\r\nfoo\r\n20\r\nbar\r\nbaz\r\n\r\n20
  3251. /a[[:punct:]b]/bincode
  3252. /a[b[:punct:]]/bincode
  3253. /L(?#(|++<!(2)?/B
  3254. /L(?#(|++<!(2)?/B,no_auto_possess
  3255. /L(?#(|++<!(2)?/B,auto_callout
  3256. /L(?#(|++<!(2)?/B,no_auto_possess,auto_callout
  3257. /(A*)\E+/B,auto_callout
  3258. /()\Q\E*]/B,auto_callout
  3259. a[bc]d
  3260. /\x8a+f|;T?(*:;.'?`(\xeap ){![^()!y*''C*(?';]{1;(\x08)/B,alt_verbnames,dupnames,extended
  3261. # Tests for NULL characters in comments and verb "names" and callouts
  3262. # /A#B\x00C\x0aZ/
  3263. /41 23 42 00 43 0a 5a/Bx,hex
  3264. # /A+#B\x00C\x0a+/
  3265. /41 2b 23 42 00 43 0a 2b/Bx,hex
  3266. # /A(*:B\x00W#X\00Y\x0aC)Z/
  3267. /41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex,alt_verbnames
  3268. # /A(*:B\x00W#X\00Y\x0aC)Z/
  3269. /41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex
  3270. # /A(?C{X\x00Y})B/
  3271. /41 28 3f 43 7b 58 00 59 7d 29 42/B,hex
  3272. # /A(?#X\x00Y)B/
  3273. /41 28 3f 23 7b 00 7d 29 42/B,hex
  3274. # Tests for leading comment in extended patterns
  3275. / (?-x):?/extended
  3276. / (?-x):?/extended
  3277. /0b 28 3f 2d 78 29 3a/hex,extended
  3278. /#comment
  3279. (?-x):?/extended
  3280. /(8(*:6^\x09x\xa6l\)6!|\xd0:[^:|)\x09d\Z\d{85*m(?'(?<1!)*\W[*\xff]!!h\w]*\xbe;/alt_bsux,alt_verbnames,allow_empty_class,dollar_endonly,extended,multiline,never_utf,no_dotstar_anchor,no_start_optimize
  3281. /a|(b)c/replace=>$1<,substitute_unset_empty
  3282. cat
  3283. xbcom
  3284. /a|(b)c/
  3285. cat\=replace=>$1<
  3286. cat\=replace=>$1<,substitute_unset_empty
  3287. xbcom\=replace=>$1<,substitute_unset_empty
  3288. /a|(b)c/substitute_extended
  3289. cat\=replace=>${2:-xx}<
  3290. cat\=replace=>${2:-xx}<,substitute_unknown_unset
  3291. cat\=replace=>${X:-xx}<,substitute_unknown_unset
  3292. /a|(?'X'b)c/replace=>$X<,substitute_unset_empty
  3293. cat
  3294. xbcom
  3295. /a|(?'X'b)c/replace=>$Y<,substitute_unset_empty
  3296. cat
  3297. cat\=substitute_unknown_unset
  3298. cat\=substitute_unknown_unset,-substitute_unset_empty
  3299. /a|(b)c/replace=>$2<,substitute_unset_empty
  3300. cat
  3301. cat\=substitute_unknown_unset
  3302. cat\=substitute_unknown_unset,-substitute_unset_empty
  3303. /()()()/use_offset_limit
  3304. \=ovector=11000000000
  3305. \=callout_fail=11000000000
  3306. \=callout_fail=1:11000000000
  3307. \=callout_data=11000000000
  3308. \=callout_data=-11000000000
  3309. \=offset_limit=1100000000000000000000
  3310. \=copy=11000000000
  3311. /(*MARK:A\x00b)/mark
  3312. abc
  3313. /(*MARK:A\x00b)/mark,alt_verbnames
  3314. abc
  3315. /"(*MARK:A" 00 "b)"/mark,hex
  3316. abc
  3317. /"(*MARK:A" 00 "b)"/mark,hex,alt_verbnames
  3318. abc
  3319. /efg/hex
  3320. /eff/hex
  3321. /effg/hex
  3322. /(?J)(?'a'))(?'a')/
  3323. /(?<=((?C)0))/
  3324. 9010
  3325. \= Expect no match
  3326. abc
  3327. /aaa/
  3328. \[abc]{10000000000000000000000000000}
  3329. \[a]{3}
  3330. /\[AB]{6000000000000000000000}/expand
  3331. # Hex uses pattern length, not zero-terminated. This tests for overrunning
  3332. # the given length of a pattern.
  3333. /'(*U'/hex
  3334. /'(*'/hex
  3335. /'('/hex
  3336. //hex
  3337. # These tests are here because Perl never allows a back reference in a
  3338. # lookbehind. PCRE2 supports some limited cases.
  3339. /([ab])...(?<=\1)z/
  3340. a11az
  3341. b11bz
  3342. \= Expect no match
  3343. b11az
  3344. /(?|([ab]))...(?<=\1)z/
  3345. /([ab])(\1)...(?<=\2)z/
  3346. aa11az
  3347. /(a\2)(b\1)(?<=\2)/
  3348. /(?<A>[ab])...(?<=\k'A')z/
  3349. a11az
  3350. b11bz
  3351. \= Expect no match
  3352. b11az
  3353. /(?<A>[ab])...(?<=\k'A')(?<A>)z/dupnames
  3354. # Perl does not support \g+n
  3355. /((\g+1X)?([ab]))+/
  3356. aaXbbXa
  3357. /ab(?C1)c/auto_callout
  3358. abc
  3359. /'ab(?C1)c'/hex,auto_callout
  3360. abc
  3361. # Perl accepts these, but gives a warning. We can't warn, so give an error.
  3362. /[a-[:digit:]]+/
  3363. a-a9-a
  3364. /[A-[:digit:]]+/
  3365. A-A9-A
  3366. /[a-\d]+/
  3367. a-a9-a
  3368. /(?<RA>abc)(?(R)xyz)/B
  3369. /(?<R>abc)(?(R)xyz)/B
  3370. /(?=.*[A-Z])/I
  3371. /()(?<=(?0))/
  3372. /(?<!|!(?<!))/
  3373. /(?<!|!|!||||||(?<!)||(?<!)!|!||(?<!)!|!(?<!)!|!|!|!||||!!|<!)!|!||||!|/
  3374. /{2,2{2,2/use_length
  3375. /.>*?\g'0/use_length
  3376. /.>*?\g'0/
  3377. /{„Í„ÍÍ„Í{'{22{2{{2{'{22{{22{2{'{22{2{{2{{222{{2{'{22{2{22{2{'{22{2{{2{'{22{2{22{2{'{'{22{2{22{2{'{22{2{{2{'{22{2{22{2{'{222{2Ą̈́ÍÍ„Í{'{22{2{{2{'{22{{11{2{'{22{2{{2{{'{22{2{{2{'{22{{22{1{'{22{2{{2{{222{{2{'{22{2{22{2{'{/auto_callout
  3378. //
  3379. \=get=i00000000000000000000000000000000
  3380. \=get=i2345678901234567890123456789012,get=i1245678901234567890123456789012
  3381. "(?(?C))"
  3382. /(?(?(?(?(?(?))))))/
  3383. /(?<=(?1))((?s))/anchored
  3384. /(*:ab)*/
  3385. %(*:(:(svvvvvvvvvv:]*[ Z!*;[]*[^[]*!^[+.+{{2,7}' _\\\\\\\\\\\\\)?.:.. *w////\\\Q\\\\\\\\\\\\\\\T\\\\\+/?/////'+\\\EEE?/////'+/*+/[^K]?]//(w)%never_backslash_c,alt_verbnames,auto_callout
  3386. /./newline=crlf
  3387. \=ph
  3388. /(\x0e00\000000\xc)/replace=\P,substitute_extended
  3389. \x0e00\000000\xc
  3390. //replace=0
  3391. \=offset=7
  3392. /(?<=\G.)/g,replace=+
  3393. abc
  3394. ".+\QX\E+"B,no_auto_possess
  3395. ".+\QX\E+"B,auto_callout,no_auto_possess
  3396. # This one is here because Perl gives an 'unmatched )' error which goes away
  3397. # if one of the \) sequences is removed - which is weird. PCRE finds it too
  3398. # complicated to find a minimum matching length.
  3399. "()X|((((((((()))))))((((())))))\2())((((((\2\2)))\2)(\22((((\2\2)2))\2)))(2\ZZZ)+:)Z^|91ZiZZnter(ZZ |91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z+:)Z|91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z((Z*(\2(Z\':))\0)i|||||||||||||||loZ\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \)\0nte!rnal errpr\2\\21r(2\ZZZ)+:)Z!|91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \)\0(2\ZZZ)+:)Z^|91ZiZZnter(ZZ |91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \)\0(2\ZZZ)+:)Z^)))int \)\0(2\ZZZ)+:)Z^|91ZiZZnter(ZZernZal ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \))\ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)))\2))))((((((\2\2))))))"I
  3400. # This checks that new code for handling groups that may match an empty string
  3401. # works on a very large number of alternatives. This pattern used to provoke a
  3402. # complaint that it was too complicated.
  3403. /(?:\[A|B|C|D|E|F|G|H|I|J|]{200}Z)/expand
  3404. # This one used to compile rubbish instead of a compile error, and then
  3405. # behave unpredictably at match time.
  3406. /.+(?(?C'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))?!XXXX.=X/
  3407. .+(?(?C'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))?!XXXX.=X
  3408. /[:[:alnum:]-[[a:lnum:]+/
  3409. /((?(?C'')\QX\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
  3410. /((?(?C'')\Q\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
  3411. /abcd/auto_callout
  3412. abcd\=callout_error=255:2
  3413. /()(\g+65534)/
  3414. /()(\g+65533)/
  3415. /Á\x00\x00\x00š(\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\x00k\d+\x00‎\x00\x00\x00\x00\x00\2*\x00\x00\1*.){36}int^\x00\x00ÿÿ\x00š(\1{50779}?)J\w2/I
  3416. /(a)(b)\2\1\1\1\1/I
  3417. /(?<a>a)(?<b>b)\g{b}\g{a}\g{a}\g{a}\g{a}(?<a>xx)(?<b>zz)/I,dupnames
  3418. //
  3419. \=ovector=7777777777
  3420. # This is here because Perl matches, even though a COMMIT is encountered
  3421. # outside of the recursion.
  3422. /(?1)(A(*COMMIT)|B)D/
  3423. BAXBAD
  3424. "(?1){2}(a)"B
  3425. "(?1){2,4}(a)"B
  3426. # This test differs from Perl for the first subject. Perl ends up with
  3427. # $1 set to 'B'; PCRE2 has it unset (which I think is right).
  3428. /^(?:
  3429. (?:A| (?:B|B(*ACCEPT)) (?<=(.)) D)
  3430. (Z)
  3431. )+$/x
  3432. AZB
  3433. AZBDZ
  3434. # The first of these, when run by Perl, gives the mark 'aa', which is wrong.
  3435. '(?>a(*:aa))b|ac' mark
  3436. ac
  3437. '(?:a(*:aa))b|ac' mark
  3438. ac
  3439. /(R?){65}/
  3440. (R?){65}
  3441. /\[(a)]{60}/expand
  3442. aaaa
  3443. /(?<!\1((?U)1((?U))))(*F)/never_backslash_c,alt_bsux,anchored,extended
  3444. /\g{3/
  3445. /(a(?C1)(b)(c)d)+/
  3446. abcdabcd\=callout_capture
  3447. # Perl matches this one, but PCRE does not because (*ACCEPT) clears out any
  3448. # pending backtracks in the recursion.
  3449. /^ (?(DEFINE) (..(*ACCEPT)|...) ) (?1)$/x
  3450. \= Expect no match
  3451. abc
  3452. # Perl gives no match for this one
  3453. /(a(*MARK:m)(*ACCEPT)){0}(?1)/mark
  3454. abc
  3455. /abc/endanchored
  3456. xyzabc
  3457. \= Expect no match
  3458. xyzabcdef
  3459. \= Expect error
  3460. xyzabc\=ph
  3461. /abc/
  3462. xyzabc\=endanchored
  3463. \= Expect no match
  3464. xyzabcdef\=endanchored
  3465. \= Expect error
  3466. xyzabc\=ps,endanchored
  3467. /abc(*ACCEPT)d/endanchored
  3468. xyzabc
  3469. \= Expect no match
  3470. xyzabcdef
  3471. /abc|bcd/endanchored
  3472. xyzabcd
  3473. \= Expect no match
  3474. xyzabcdef
  3475. /a(*ACCEPT)x|aa/endanchored
  3476. aaa
  3477. # Check auto-anchoring when there is a group that is never obeyed at
  3478. # the start of a branch.
  3479. /(?(DEFINE)(a))^bc/I
  3480. /(a){0}.*bc/sI
  3481. # This should be anchored, as the condition is always false and there is
  3482. # no alternative branch.
  3483. /(?(VERSION>=999)yes)^bc/I
  3484. # This should not be anchored.
  3485. /(?(VERSION>=999)yes|no)^bc/I
  3486. /(*LIMIT_HEAP=0)xxx/I
  3487. /\d{0,3}(*:abc)(?C1)xxx/callout_info
  3488. # ----------------------------------------------------------------------
  3489. # These are a whole pile of tests that touch lines of code that are not
  3490. # used by any other tests (at least when these were created).
  3491. /^a+?x/i,no_start_optimize,no_auto_possess
  3492. \= Expect no match
  3493. aaa
  3494. /^[^a]{3,}?x/i,no_start_optimize,no_auto_possess
  3495. \= Expect no match
  3496. bbb
  3497. cc
  3498. /^X\S/no_start_optimize,no_auto_possess
  3499. \= Expect no match
  3500. X
  3501. /^X\W/no_start_optimize,no_auto_possess
  3502. \= Expect no match
  3503. X
  3504. /^X\H/no_start_optimize,no_auto_possess
  3505. \= Expect no match
  3506. X
  3507. /^X\h/no_start_optimize,no_auto_possess
  3508. \= Expect no match
  3509. X
  3510. /^X\V/no_start_optimize,no_auto_possess
  3511. \= Expect no match
  3512. X
  3513. /^X\v/no_start_optimize,no_auto_possess
  3514. \= Expect no match
  3515. X
  3516. /^X\h/no_start_optimize,no_auto_possess
  3517. \= Expect no match
  3518. XY
  3519. /^X\V/no_start_optimize,no_auto_possess
  3520. \= Expect no match
  3521. X\n
  3522. /^X\v/no_start_optimize,no_auto_possess
  3523. \= Expect no match
  3524. XX
  3525. /^X.+?/s,no_start_optimize,no_auto_possess
  3526. \= Expect no match
  3527. X
  3528. /^X\R+?/no_start_optimize,no_auto_possess
  3529. \= Expect no match
  3530. XX
  3531. /^X\H+?/no_start_optimize,no_auto_possess
  3532. \= Expect no match
  3533. X
  3534. /^X\h+?/no_start_optimize,no_auto_possess
  3535. \= Expect no match
  3536. X
  3537. /^X\V+?/no_start_optimize,no_auto_possess
  3538. \= Expect no match
  3539. X
  3540. X\n
  3541. /^X\D+?/no_start_optimize,no_auto_possess
  3542. \= Expect no match
  3543. X
  3544. X9
  3545. /^X\S+?/no_start_optimize,no_auto_possess
  3546. \= Expect no match
  3547. X
  3548. X\n
  3549. /^X\W+?/no_start_optimize,no_auto_possess
  3550. \= Expect no match
  3551. X
  3552. XX
  3553. /^X.+?Z/no_start_optimize,no_auto_possess
  3554. \= Expect no match
  3555. XY\n
  3556. /(*CRLF)^X.+?Z/no_start_optimize,no_auto_possess
  3557. \= Expect no match
  3558. XY\r\=ps
  3559. /^X\R+?Z/no_start_optimize,no_auto_possess
  3560. \= Expect no match
  3561. X\nX
  3562. X\n\r\n
  3563. X\n\rY
  3564. X\n\nY
  3565. X\n\x{0c}Y
  3566. /(*BSR_ANYCRLF)^X\R+?Z/no_start_optimize,no_auto_possess
  3567. \= Expect no match
  3568. X\nX
  3569. X\n\r\n
  3570. X\n\rY
  3571. X\n\nY
  3572. X\n\x{0c}Y
  3573. /^X\H+?Z/no_start_optimize,no_auto_possess
  3574. \= Expect no match
  3575. XY\t
  3576. XYY
  3577. /^X\h+?Z/no_start_optimize,no_auto_possess
  3578. \= Expect no match
  3579. X\t\t
  3580. X\tY
  3581. /^X\V+?Z/no_start_optimize,no_auto_possess
  3582. \= Expect no match
  3583. XY\n
  3584. XYY
  3585. /^X\v+?Z/no_start_optimize,no_auto_possess
  3586. \= Expect no match
  3587. X\n\n
  3588. X\nY
  3589. /^X\D+?Z/no_start_optimize,no_auto_possess
  3590. \= Expect no match
  3591. XY9
  3592. XYY
  3593. /^X\d+?Z/no_start_optimize,no_auto_possess
  3594. \= Expect no match
  3595. X99
  3596. X9Y
  3597. /^X\S+?Z/no_start_optimize,no_auto_possess
  3598. \= Expect no match
  3599. XY\n
  3600. XYY
  3601. /^X\s+?Z/no_start_optimize,no_auto_possess
  3602. \= Expect no match
  3603. X\n\n
  3604. X\nY
  3605. /^X\W+?Z/no_start_optimize,no_auto_possess
  3606. \= Expect no match
  3607. X.A
  3608. X++
  3609. /^X\w+?Z/no_start_optimize,no_auto_possess
  3610. \= Expect no match
  3611. Xa.
  3612. Xaa
  3613. /^X.{1,3}Z/s,no_start_optimize,no_auto_possess
  3614. \= Expect no match
  3615. Xa.bd
  3616. /^X\h+Z/no_start_optimize,no_auto_possess
  3617. \= Expect no match
  3618. X\t\t
  3619. X\tY
  3620. /^X\V+Z/no_start_optimize,no_auto_possess
  3621. \= Expect no match
  3622. XY\n
  3623. XYY
  3624. /^(X(*THEN)Y|AB){0}(?1)/
  3625. ABX
  3626. \= Expect no match
  3627. XAB
  3628. /^(?!A(?C1)B)C/
  3629. ABC\=callout_error=1,no_jit
  3630. /^(?!A(?C1)B)C/no_start_optimize
  3631. ABC\=callout_error=1
  3632. /^(?(?!A(?C1)B)C)/
  3633. ABC\=callout_error=1
  3634. # ----------------------------------------------------------------------
  3635. /[a b c]/BxxI
  3636. /[a b c]/BxxxI
  3637. /[a b c]/B,extended_more
  3638. /[ a b c ]/B,extended_more
  3639. /[a b](?xx: [ 12 ] (?-xx:[ 34 ]) )y z/B
  3640. # Unsetting /x also unsets /xx
  3641. /[a b](?xx: [ 12 ] (?-x:[ 34 ]) )y z/B
  3642. /(a)(?-n:(b))(c)/nB
  3643. # ----------------------------------------------------------------------
  3644. # These test the dangerous PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL option.
  3645. /\j\x{z}\o{82}\L\uabcd\u\U\g{\g/B,\bad_escape_is_literal
  3646. /\N{\c/IB,bad_escape_is_literal
  3647. /[\j\x{z}\o\gAb\g]/B,bad_escape_is_literal
  3648. /[Q-\N]/B,bad_escape_is_literal
  3649. /[\s-_]/bad_escape_is_literal
  3650. /[_-\s]/bad_escape_is_literal
  3651. /[\B\R\X]/B
  3652. /[\B\R\X]/B,bad_escape_is_literal
  3653. /[A-\BP-\RV-\X]/B
  3654. /[A-\BP-\RV-\X]/B,bad_escape_is_literal
  3655. # ----------------------------------------------------------------------
  3656. /a\b(c/literal
  3657. a\\b(c
  3658. /a\b(c/literal,caseless
  3659. a\\b(c
  3660. a\\B(c
  3661. /a\b(c/literal,firstline
  3662. XYYa\\b(c
  3663. \= Expect no match
  3664. X\na\\b(c
  3665. /a\b?c/literal,use_offset_limit
  3666. XXXXa\\b?c\=offset_limit=4
  3667. \= Expect no match
  3668. XXXXa\\b?c\=offset_limit=3
  3669. /a\b(c/literal,anchored,endanchored
  3670. a\\b(c
  3671. \= Expect no match
  3672. Xa\\b(c
  3673. a\\b(cX
  3674. Xa\\b(cX
  3675. //literal,extended
  3676. /a\b(c/literal,auto_callout,no_start_optimize
  3677. XXXXa\\b(c
  3678. /a\b(c/literal,auto_callout
  3679. XXXXa\\b(c
  3680. /(*CR)abc/literal
  3681. (*CR)abc
  3682. /cat|dog/I,match_word
  3683. the cat sat
  3684. \= Expect no match
  3685. caterpillar
  3686. snowcat
  3687. syndicate
  3688. /(cat)|dog/I,match_line,literal
  3689. (cat)|dog
  3690. \= Expect no match
  3691. the cat sat
  3692. caterpillar
  3693. snowcat
  3694. syndicate
  3695. /a whole line/match_line,multiline
  3696. Rhubarb \na whole line\n custard
  3697. \= Expect no match
  3698. Not a whole line
  3699. # Perl gets this wrong, failing to capture 'b' in group 1.
  3700. /^(b+|a){1,2}?bc/
  3701. bbc
  3702. # And again here, for the "babc" subject string.
  3703. /^(b*|ba){1,2}?bc/
  3704. babc
  3705. bbabc
  3706. bababc
  3707. \= Expect no match
  3708. bababbc
  3709. babababc
  3710. /[[:digit:]-a]/
  3711. /[[:digit:]-[:print:]]/
  3712. /[\d-a]/
  3713. /[\H-z]/
  3714. /[\d-[:print:]]/
  3715. # Perl gets the second of these wrong, giving no match.
  3716. "(?<=(a))\1?b"I
  3717. ab
  3718. aaab
  3719. "(?=(a))\1?b"I
  3720. ab
  3721. aaab
  3722. # JIT does not support callout_extra
  3723. /(*NO_JIT)(a+)b/auto_callout,no_start_optimize,no_auto_possess
  3724. \= Expect no match
  3725. aac\=callout_extra
  3726. /(*NO_JIT)a+(?C'XXX')b/no_start_optimize,no_auto_possess
  3727. \= Expect no match
  3728. aac\=callout_extra
  3729. /\n/firstline
  3730. xyz\nabc
  3731. /\nabc/firstline
  3732. xyz\nabc
  3733. /\x{0a}abc/firstline,newline=crlf
  3734. \= Expect no match
  3735. xyz\r\nabc
  3736. /[abc]/firstline
  3737. \= Expect no match
  3738. \na
  3739. # These tests are matched in test 1 as they are Perl compatible. Here we are
  3740. # looking at what does and does not get auto-possessified.
  3741. /(?(DEFINE)(?<optional_a>a?))^(?&optional_a)a$/B
  3742. /(?(DEFINE)(?<optional_a>a?)X)^(?&optional_a)a$/B
  3743. /^(a?)b(?1)a/B
  3744. /^(a?)+b(?1)a/B
  3745. /^(a?)++b(?1)a/B
  3746. /^(a?)+b/B
  3747. /(?=a+)a(a+)++b/B
  3748. /(?<=(?=.){4,5}x)/B
  3749. # Perl behaves differently with these when optimization is turned off
  3750. /a(*PRUNE:X)bc|qq/mark,no_start_optimize
  3751. \= Expect no match
  3752. axy
  3753. /a(*THEN:X)bc|qq/mark,no_start_optimize
  3754. \= Expect no match
  3755. axy
  3756. /(?^x-i)AB/
  3757. /(?^-i)AB/
  3758. /(?x-i-i)/
  3759. /(?(?=^))b/I
  3760. abc
  3761. /(?(?=^)|)b/I
  3762. abc
  3763. /(?(?=^)|^)b/I
  3764. bbc
  3765. \= Expect no match
  3766. abc
  3767. /(?(1)^|^())/I
  3768. /(?(1)^())b/I
  3769. /(?(1)^())+b/I,aftertext
  3770. abc
  3771. /(?(1)^()|^)+b/I,aftertext
  3772. bbc
  3773. \= Expect no match
  3774. abc
  3775. /(?(1)^()|^)*b/I,aftertext
  3776. bbc
  3777. abc
  3778. xbc
  3779. /(?(1)^())+b/I,aftertext
  3780. abc
  3781. /(?(1)^a()|^a)+b/I,aftertext
  3782. abc
  3783. \= Expect no match
  3784. bbc
  3785. /(?(1)^|^(a))+b/I,aftertext
  3786. abc
  3787. \= Expect no match
  3788. bbc
  3789. /(?(1)^a()|^a)*b/I,aftertext
  3790. abc
  3791. bbc
  3792. xbc
  3793. /a(b)c|xyz/g,allvector,replace=<$0>
  3794. abcdefabcpqr\=ovector=4
  3795. abxyz\=ovector=4
  3796. abcdefxyz\=ovector=4
  3797. /a(b)c|xyz/allvector
  3798. abcdef\=ovector=4
  3799. abxyz\=ovector=4
  3800. /a(b)c|xyz/g,replace=<$0>,substitute_callout
  3801. abcdefabcpqr
  3802. abxyzpqrabcxyz
  3803. 12abc34xyz99abc55\=substitute_stop=2
  3804. 12abc34xyz99abc55\=substitute_skip=1
  3805. 12abc34xyz99abc55\=substitute_skip=2
  3806. /a(b)c|xyz/g,replace=<$0>
  3807. abcdefabcpqr
  3808. abxyzpqrabcxyz
  3809. 12abc34xyz\=substitute_stop=2
  3810. 12abc34xyz\=substitute_skip=1
  3811. /a(b)c|xyz/replace=<$0>
  3812. abcdefabcpqr
  3813. 12abc34xyz\=substitute_skip=1
  3814. 12abc34xyz\=substitute_stop=1
  3815. /abc\rdef/
  3816. abc\ndef
  3817. /abc\rdef\x{0d}xyz/escaped_cr_is_lf
  3818. abc\ndef\rxyz
  3819. \= Expect no match
  3820. abc\ndef\nxyz
  3821. /(?(*ACCEPT)xxx)/
  3822. /(?(*atomic:xx)xxx)/
  3823. /(?(*script_run:xxx)zzz)/
  3824. /foobar/
  3825. the foobar thing\=copy_matched_subject
  3826. the foobar thing\=copy_matched_subject,zero_terminate
  3827. /foobar/g
  3828. the foobar thing foobar again\=copy_matched_subject
  3829. /(*:XX)^abc/I
  3830. /(*COMMIT:XX)^abc/I
  3831. /(*ACCEPT:XX)^abc/I
  3832. /abc/replace=xyz
  3833. abc\=null_context
  3834. /abc/replace=xyz,substitute_callout
  3835. abc
  3836. \= Expect error message
  3837. abc\=null_context
  3838. /\[()]{65535}()/expand
  3839. /\[()]{65535}(?<A>)/expand
  3840. /a(?:(*ACCEPT))??bc/
  3841. abc
  3842. axy
  3843. /a(*ACCEPT)??bc/
  3844. abc
  3845. axy
  3846. /a(*ACCEPT:XX)??bc/mark
  3847. abc
  3848. axy
  3849. /(*:\)?/
  3850. /(*:\Q \E){5}/alt_verbnames
  3851. /(?=abc)/I
  3852. /(?|(X)|(XY))\1abc/I
  3853. /(?|(a)|(bcde))(c)\2/I
  3854. /(?|(a)|(bcde))(c)\1/I
  3855. /(?|(?'A'a)|(?'A'bcde))(?'B'c)\k'B'(?'A')/I,dupnames
  3856. /(?|(?'A'a)|(?'A'bcde))(?'B'c)\k'A'(?'A')/I,dupnames
  3857. /((a|)+)+Z/I
  3858. /((?=a))[abcd]/I
  3859. /A(?:(*ACCEPT))?B/info
  3860. /(A(*ACCEPT)??B)C/
  3861. ABC
  3862. AXY
  3863. /(?<=(?<=a)b)c.*/I
  3864. abc\=ph
  3865. \= Expect no match
  3866. xbc\=ph
  3867. /(?<=ab)c.*/I
  3868. abc\=ph
  3869. \= Expect no match
  3870. xbc\=ph
  3871. /(?<=a(?<=a|a)c)/I
  3872. /(?<=a(?<=a|ba)c)/I
  3873. /(?<=(?<=a)b)(?<!abcd)/I
  3874. /(?<=(?<=a)b)(?<!abcd)(?<=(?<=a)bcde)/I
  3875. # Addition overflow
  3876. /( {32742} {42})(?<!\1{65481})/
  3877. # Multiplication overflow
  3878. /(X{65535})(?<=\1{32770})/
  3879. # ---- Non-atomic assertion tests ----
  3880. # Expect error: not allowed as a condition
  3881. /(?(*napla:xx)bc)/
  3882. /\A(*pla:.*\b(\w++))(?>.*?\b\1\b){3}/
  3883. word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
  3884. /\A(*napla:.*\b(\w++))(?>.*?\b\1\b){3}/
  3885. word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
  3886. /\A(?*.*\b(\w++))(?>.*?\b\1\b){3}/
  3887. word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
  3888. /(*plb:(.)..|(.)...)(\1|\2)/
  3889. abcdb\=offset=4
  3890. abcda\=offset=4
  3891. /(*naplb:(.)..|(.)...)(\1|\2)/
  3892. abcdb\=offset=4
  3893. abcda\=offset=4
  3894. /(?<*(.)..|(.)...)(\1|\2)/
  3895. abcdb\=offset=4
  3896. abcda\=offset=4
  3897. /(*non_atomic_positive_lookahead:ab)/B
  3898. /(*non_atomic_positive_lookbehind:ab)/B
  3899. /(*pla:ab+)/B
  3900. /(*napla:ab+)/B
  3901. /(*napla:)+/
  3902. /(*naplb:)+/
  3903. /(*napla:^x|^y)/I
  3904. /(*napla:abc|abd)/I
  3905. /(*napla:a|(.)(*ACCEPT)zz)\1../
  3906. abcd
  3907. /(*napla:a(*ACCEPT)zz|(.))\1../
  3908. abcd
  3909. /(*napla:a|(*COMMIT)(.))\1\1/
  3910. aabc
  3911. \= Expect no match
  3912. abbc
  3913. /(*napla:a|(.))\1\1/
  3914. aabc
  3915. abbc
  3916. /(*naplb:ab?c|PQ).../g
  3917. abcdefgacxyzPQR123
  3918. # ----
  3919. # Expect error (recursion => not fixed length)
  3920. /(\2)((?=(?<=\1)))/
  3921. /c*+(?<=[bc])/
  3922. abc\=ph
  3923. ab\=ph
  3924. abc\=ps
  3925. ab\=ps
  3926. /c++(?<=[bc])/
  3927. abc\=ph
  3928. ab\=ph
  3929. /(?<=(?=.(?<=x)))/
  3930. abx
  3931. ab\=ph
  3932. bxyz
  3933. xyz
  3934. /\z/
  3935. abc\=ph
  3936. abc\=ps
  3937. /\Z/
  3938. abc\=ph
  3939. abc\=ps
  3940. abc\n\=ph
  3941. abc\n\=ps
  3942. /(?![ab]).*/
  3943. ab\=ph
  3944. /c*+/
  3945. ab\=ph,offset=2
  3946. /\A\s*(a|(?:[^`]{28500}){4})/I
  3947. a
  3948. /\A\s*((?:[^`]{28500}){4})/I
  3949. /\A\s*((?:[^`]{28500}){4}|a)/I
  3950. a
  3951. /(?<A>a)(?(<A>)b)((?<=b).*)/B
  3952. /(?(1)b)((?<=b).*)/B
  3953. /(?(R1)b)((?<=b).*)/B
  3954. /(?(DEFINE)b)((?<=b).*)/B
  3955. /(?(VERSION=10.3)b)((?<=b).*)/B
  3956. /[aA]b[cC]/IB
  3957. /[cc]abcd/I
  3958. /[Cc]abcd/I
  3959. /[c]abcd/I
  3960. /(?:c|C)abcd/I
  3961. /(a)?a/I
  3962. manm
  3963. /^(?|(\*)(*napla:\S*_(\2?+.+))|(\w)(?=\S*_(\2?+\1)))+_\2$/
  3964. *abc_12345abc
  3965. /^(?|(\*)(*napla:\S*_(\3?+.+))|(\w)(?=\S*_((\2?+\1))))+_\2$/
  3966. *abc_12345abc
  3967. /^((\1+)(?C)|\d)+133X$/
  3968. 111133X\=callout_capture
  3969. /abc/replace=xyz,substitute_replacement_only
  3970. 123abc456
  3971. /a(?<ONE>b)c(?<TWO>d)e/g,replace=X$ONE+${TWO}Z,substitute_replacement_only
  3972. "abcde-abcde-"
  3973. /a(b)c|xyz/g,replace=<$0>,substitute_callout,substitute_replacement_only
  3974. abcdefabcpqr
  3975. abxyzpqrabcxyz
  3976. 12abc34xyz99abc55\=substitute_stop=2
  3977. 12abc34xyz99abc55\=substitute_skip=1
  3978. 12abc34xyz99abc55\=substitute_skip=2
  3979. /a(..)d/replace=>$1<,substitute_matched
  3980. xyzabcdxyzabcdxyz
  3981. xyzabcdxyzabcdxyz\=ovector=2
  3982. \= Expect error
  3983. xyzabcdxyzabcdxyz\=ovector=1
  3984. /a(..)d/g,replace=>$1<,substitute_matched
  3985. xyzabcdxyzabcdxyz
  3986. xyzabcdxyzabcdxyz\=ovector=2
  3987. \= Expect error
  3988. xyzabcdxyzabcdxyz\=ovector=1
  3989. xyzabcdxyzabcdxyz\=ovector=1,substitute_unset_empty
  3990. /55|a(..)d/g,replace=>$1<,substitute_matched
  3991. xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
  3992. \= Expect error
  3993. xyz55abcdxyzabcdxyz\=ovector=2
  3994. /55|a(..)d/replace=>$1<,substitute_matched
  3995. xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
  3996. /55|a(..)d/replace=>$1<
  3997. xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
  3998. /55|a(..)d/g,replace=>$1<
  3999. xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
  4000. /abc/replace=,caseless
  4001. XabcY
  4002. XABCY
  4003. /abc/replace=[4],caseless
  4004. XabcY
  4005. XABCY
  4006. /abc/replace=*,caseless
  4007. XabcY
  4008. XABCY
  4009. XabcY\=replace=
  4010. # Expect non-fixed-length error
  4011. "(?<=X(?(DEFINE)(.*))(?1))."
  4012. /\sxxx\s/tables=1
  4013. \= Expect no match
  4014. AB\x{85}xxx\x{a0}XYZ
  4015. /\sxxx\s/tables=2
  4016. AB\x{85}xxx\x{a0}XYZ
  4017. /^\w+/tables=2
  4018. École
  4019. /^\w+/tables=3
  4020. École
  4021. #loadtables ./testbtables
  4022. /^\w+/tables=3
  4023. École
  4024. /"(*MARK:>" 00 "<).."/hex,mark,no_start_optimize
  4025. AB
  4026. A\=ph
  4027. \= Expect no match
  4028. A
  4029. /"(*MARK:>" 00 "<).(?C1)."/hex,mark,no_start_optimize
  4030. AB
  4031. /(?(VERSION=0.0/
  4032. # Perl has made \K in lookarounds an error. PCRE2 now rejects as well, unless
  4033. # explicitly authorized.
  4034. /(?=a\Kb)ab/
  4035. /(?=a\Kb)ab/allow_lookaround_bsk
  4036. ab
  4037. /(?!a\Kb)ac/
  4038. /(?!a\Kb)ac/allow_lookaround_bsk
  4039. ac
  4040. /^abc(?<=b\Kc)d/
  4041. /^abc(?<=b\Kc)d/allow_lookaround_bsk
  4042. abcd
  4043. /^abc(?<!b\Kq)d/
  4044. /^abc(?<!b\Kq)d/,allow_lookaround_bsk
  4045. abcd
  4046. # ---------
  4047. # Tests for zero-length NULL to be treated as an empty string.
  4048. //
  4049. \=null_subject
  4050. \= Expect error
  4051. abc\=null_subject
  4052. //replace=[20]
  4053. abc\=null_replacement
  4054. \=null_subject
  4055. \=null_replacement
  4056. /X*/g,replace=xy
  4057. \= Expect error
  4058. >X<\=null_replacement
  4059. /X+/replace=[20]
  4060. >XX<\=null_replacement
  4061. # ---------
  4062. /[Aa]{2}/BI
  4063. aabcd
  4064. /A{2}/iBI
  4065. aabcd
  4066. /[Aa]{2,3}/BI
  4067. aabcd
  4068. --
  4069. \[X]{-10}
  4070. # Check imposition of maximum by match_data_create().
  4071. /abcd/
  4072. abcd\=ovector=65536
  4073. # Use recurse to test \K and Mark in atomic scope.
  4074. /(?>this line\s*((?R)|)\K)/
  4075. this line this line this line
  4076. /(?>this line\s*((?R)|)(*MARK:A))/
  4077. this line this line this line
  4078. # Check use of NULL pattern with zero length.
  4079. //null_pattern,use_length
  4080. abc
  4081. //null_pattern
  4082. /bad null pattern/null_pattern,use_length
  4083. /bad null pattern/null_pattern
  4084. # -------- Variable length lookbehinds --------
  4085. /12345(?<=\d{1,256})X/
  4086. /(?<=(\d{1,256}))X/max_varlookbehind=256
  4087. 12345XYZ
  4088. /12345(?<=a?bc)X/max_varlookbehind=0
  4089. /12345(?<=abc)X/max_varlookbehind=0
  4090. /(?<!( {65054}){9,44965})/
  4091. /(?(?<!|(|a)))/
  4092. aaaa\=get=0
  4093. /(?(?<!|a?))/
  4094. aaaa\=get=0
  4095. # --------
  4096. /(?<=(()()()()()()()()()()()()()(()()()()(())()()()()(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(())()()()()(()()()()()()(()()()()()()()()()()()()()()()()()()()()()(())()()()()(()()()()()()()()()()()()()(()()()()()()()()()()()()()(()())))))))))/
  4097. /(?<!( {65054}){0,44965})/auto_callout
  4098. /A+{,3}/
  4099. /(\g{+1}Z|(A))+/
  4100. BAAZCD
  4101. ZAAAZAZAZAACD
  4102. # This doesn't work in Perl (though I think it used to)
  4103. /^(?=.*(?=(([A-Z]).*(?(1)\1)))(?!.+\2)){26}/i
  4104. The quick brown fox jumps over the lazy dog.
  4105. Jackdaws love my big sphinx of quartz.
  4106. Pack my box with five dozen liquor jugs.
  4107. \= Expect no match
  4108. The quick brown fox jumps over the lazy cat.
  4109. Hackdaws love my big sphinx of quartz.
  4110. Pack my fox with five dozen liquor jugs.
  4111. # These are different to Perl because of the different capturing in repeating
  4112. # groups.
  4113. /((foo)|(bar))*/
  4114. foobar
  4115. /(?:(f)(o)(o)|(b)(a)(r))*/
  4116. foobar
  4117. /((Z)+|A)*/
  4118. ZABCDEFG
  4119. /(?:(?P=same)?(?:(?P<same>a)|(?P<same>b))(?P=same))+/g,dupnames
  4120. bbbaaabaabb
  4121. # --------
  4122. /
  4123. /anchored, firstline
  4124. \x0a
  4125. /
  4126. /anchored,firstline,no_start_optimize
  4127. \x0a
  4128. /
  4129. /firstline
  4130. \x0a
  4131. abc\x0adef
  4132. # This test is currently broken in the interpreter
  4133. # /|a(?0)/endanchored
  4134. # aaaa
  4135. /A +/extended
  4136. /(*ACCEPT)+/B,auto_callout
  4137. /a\z/
  4138. a
  4139. a\=noteol
  4140. # This matches a character that only exists once in the subject, sort of like a
  4141. # hypothetical "(.)(?<!\1.+)(?!.*\1)". That has unlimited variable length
  4142. # lookbehind, so is invalid. This pattern doesn't work in Perl 5.38.0.
  4143. /\G(?:(?=(\1.|)(.))){1,13}?(?!.*\2.*\2)\1\K\2/g
  4144. aaabcccdeee
  4145. /|(?0)./endanchored
  4146. abcd
  4147. /|a(?0)/endanchored
  4148. aaaa
  4149. /(?:|(?0).)(?(R)|\z)/
  4150. abcd
  4151. /a?(?=b(*COMMIT)c|)d/I
  4152. bd
  4153. /(?=b(*COMMIT)c|)d/I
  4154. bd
  4155. /a?(?=b(*COMMIT)c|)d/I,no_start_optimize
  4156. bd
  4157. /(?=b(*COMMIT)c|)d/I,no_start_optimize
  4158. bd
  4159. /a?(?=bc|)d/I,auto_callout
  4160. bd
  4161. /a?(?=bc|)\bd/I
  4162. bd
  4163. /(?0)/
  4164. abc\=disable_recurseloop_check,match_limit=100
  4165. /(a(?1)z||(?1)++)$/
  4166. abcd\=disable_recurseloop_check
  4167. # End of testinput2