testinput2 100 KB

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