testoutput1 133 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473
  1. /-- This set of tests is for features that are compatible with all versions of
  2. Perl >= 5.10, in non-UTF-8 mode. It should run clean for the 8-bit, 16-bit,
  3. and 32-bit PCRE libraries. --/
  4. < forbid 89?=ABCDEFfGILMNPTUWXZ<
  5. /the quick brown fox/
  6. the quick brown fox
  7. 0: the quick brown fox
  8. The quick brown FOX
  9. No match
  10. What do you know about the quick brown fox?
  11. 0: the quick brown fox
  12. What do you know about THE QUICK BROWN FOX?
  13. No match
  14. /The quick brown fox/i
  15. the quick brown fox
  16. 0: the quick brown fox
  17. The quick brown FOX
  18. 0: The quick brown FOX
  19. What do you know about the quick brown fox?
  20. 0: the quick brown fox
  21. What do you know about THE QUICK BROWN FOX?
  22. 0: THE QUICK BROWN FOX
  23. /abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
  24. abcd\t\n\r\f\a\e9;\$\\?caxyz
  25. 0: abcd\x09\x0a\x0d\x0c\x07\x1b9;$\?caxyz
  26. /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
  27. abxyzpqrrrabbxyyyypqAzz
  28. 0: abxyzpqrrrabbxyyyypqAzz
  29. abxyzpqrrrabbxyyyypqAzz
  30. 0: abxyzpqrrrabbxyyyypqAzz
  31. aabxyzpqrrrabbxyyyypqAzz
  32. 0: aabxyzpqrrrabbxyyyypqAzz
  33. aaabxyzpqrrrabbxyyyypqAzz
  34. 0: aaabxyzpqrrrabbxyyyypqAzz
  35. aaaabxyzpqrrrabbxyyyypqAzz
  36. 0: aaaabxyzpqrrrabbxyyyypqAzz
  37. abcxyzpqrrrabbxyyyypqAzz
  38. 0: abcxyzpqrrrabbxyyyypqAzz
  39. aabcxyzpqrrrabbxyyyypqAzz
  40. 0: aabcxyzpqrrrabbxyyyypqAzz
  41. aaabcxyzpqrrrabbxyyyypAzz
  42. 0: aaabcxyzpqrrrabbxyyyypAzz
  43. aaabcxyzpqrrrabbxyyyypqAzz
  44. 0: aaabcxyzpqrrrabbxyyyypqAzz
  45. aaabcxyzpqrrrabbxyyyypqqAzz
  46. 0: aaabcxyzpqrrrabbxyyyypqqAzz
  47. aaabcxyzpqrrrabbxyyyypqqqAzz
  48. 0: aaabcxyzpqrrrabbxyyyypqqqAzz
  49. aaabcxyzpqrrrabbxyyyypqqqqAzz
  50. 0: aaabcxyzpqrrrabbxyyyypqqqqAzz
  51. aaabcxyzpqrrrabbxyyyypqqqqqAzz
  52. 0: aaabcxyzpqrrrabbxyyyypqqqqqAzz
  53. aaabcxyzpqrrrabbxyyyypqqqqqqAzz
  54. 0: aaabcxyzpqrrrabbxyyyypqqqqqqAzz
  55. aaaabcxyzpqrrrabbxyyyypqAzz
  56. 0: aaaabcxyzpqrrrabbxyyyypqAzz
  57. abxyzzpqrrrabbxyyyypqAzz
  58. 0: abxyzzpqrrrabbxyyyypqAzz
  59. aabxyzzzpqrrrabbxyyyypqAzz
  60. 0: aabxyzzzpqrrrabbxyyyypqAzz
  61. aaabxyzzzzpqrrrabbxyyyypqAzz
  62. 0: aaabxyzzzzpqrrrabbxyyyypqAzz
  63. aaaabxyzzzzpqrrrabbxyyyypqAzz
  64. 0: aaaabxyzzzzpqrrrabbxyyyypqAzz
  65. abcxyzzpqrrrabbxyyyypqAzz
  66. 0: abcxyzzpqrrrabbxyyyypqAzz
  67. aabcxyzzzpqrrrabbxyyyypqAzz
  68. 0: aabcxyzzzpqrrrabbxyyyypqAzz
  69. aaabcxyzzzzpqrrrabbxyyyypqAzz
  70. 0: aaabcxyzzzzpqrrrabbxyyyypqAzz
  71. aaaabcxyzzzzpqrrrabbxyyyypqAzz
  72. 0: aaaabcxyzzzzpqrrrabbxyyyypqAzz
  73. aaaabcxyzzzzpqrrrabbbxyyyypqAzz
  74. 0: aaaabcxyzzzzpqrrrabbbxyyyypqAzz
  75. aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
  76. 0: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
  77. aaabcxyzpqrrrabbxyyyypABzz
  78. 0: aaabcxyzpqrrrabbxyyyypABzz
  79. aaabcxyzpqrrrabbxyyyypABBzz
  80. 0: aaabcxyzpqrrrabbxyyyypABBzz
  81. >>>aaabxyzpqrrrabbxyyyypqAzz
  82. 0: aaabxyzpqrrrabbxyyyypqAzz
  83. >aaaabxyzpqrrrabbxyyyypqAzz
  84. 0: aaaabxyzpqrrrabbxyyyypqAzz
  85. >>>>abcxyzpqrrrabbxyyyypqAzz
  86. 0: abcxyzpqrrrabbxyyyypqAzz
  87. *** Failers
  88. No match
  89. abxyzpqrrabbxyyyypqAzz
  90. No match
  91. abxyzpqrrrrabbxyyyypqAzz
  92. No match
  93. abxyzpqrrrabxyyyypqAzz
  94. No match
  95. aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
  96. No match
  97. aaaabcxyzzzzpqrrrabbbxyyypqAzz
  98. No match
  99. aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
  100. No match
  101. /^(abc){1,2}zz/
  102. abczz
  103. 0: abczz
  104. 1: abc
  105. abcabczz
  106. 0: abcabczz
  107. 1: abc
  108. *** Failers
  109. No match
  110. zz
  111. No match
  112. abcabcabczz
  113. No match
  114. >>abczz
  115. No match
  116. /^(b+?|a){1,2}?c/
  117. bc
  118. 0: bc
  119. 1: b
  120. bbc
  121. 0: bbc
  122. 1: b
  123. bbbc
  124. 0: bbbc
  125. 1: bb
  126. bac
  127. 0: bac
  128. 1: a
  129. bbac
  130. 0: bbac
  131. 1: a
  132. aac
  133. 0: aac
  134. 1: a
  135. abbbbbbbbbbbc
  136. 0: abbbbbbbbbbbc
  137. 1: bbbbbbbbbbb
  138. bbbbbbbbbbbac
  139. 0: bbbbbbbbbbbac
  140. 1: a
  141. *** Failers
  142. No match
  143. aaac
  144. No match
  145. abbbbbbbbbbbac
  146. No match
  147. /^(b+|a){1,2}c/
  148. bc
  149. 0: bc
  150. 1: b
  151. bbc
  152. 0: bbc
  153. 1: bb
  154. bbbc
  155. 0: bbbc
  156. 1: bbb
  157. bac
  158. 0: bac
  159. 1: a
  160. bbac
  161. 0: bbac
  162. 1: a
  163. aac
  164. 0: aac
  165. 1: a
  166. abbbbbbbbbbbc
  167. 0: abbbbbbbbbbbc
  168. 1: bbbbbbbbbbb
  169. bbbbbbbbbbbac
  170. 0: bbbbbbbbbbbac
  171. 1: a
  172. *** Failers
  173. No match
  174. aaac
  175. No match
  176. abbbbbbbbbbbac
  177. No match
  178. /^(b+|a){1,2}?bc/
  179. bbc
  180. 0: bbc
  181. 1: b
  182. /^(b*|ba){1,2}?bc/
  183. babc
  184. 0: babc
  185. 1: ba
  186. bbabc
  187. 0: bbabc
  188. 1: ba
  189. bababc
  190. 0: bababc
  191. 1: ba
  192. *** Failers
  193. No match
  194. bababbc
  195. No match
  196. babababc
  197. No match
  198. /^(ba|b*){1,2}?bc/
  199. babc
  200. 0: babc
  201. 1: ba
  202. bbabc
  203. 0: bbabc
  204. 1: ba
  205. bababc
  206. 0: bababc
  207. 1: ba
  208. *** Failers
  209. No match
  210. bababbc
  211. No match
  212. babababc
  213. No match
  214. /^\ca\cA\c[;\c:/
  215. \x01\x01\e;z
  216. 0: \x01\x01\x1b;z
  217. /^[ab\]cde]/
  218. athing
  219. 0: a
  220. bthing
  221. 0: b
  222. ]thing
  223. 0: ]
  224. cthing
  225. 0: c
  226. dthing
  227. 0: d
  228. ething
  229. 0: e
  230. *** Failers
  231. No match
  232. fthing
  233. No match
  234. [thing
  235. No match
  236. \\thing
  237. No match
  238. /^[]cde]/
  239. ]thing
  240. 0: ]
  241. cthing
  242. 0: c
  243. dthing
  244. 0: d
  245. ething
  246. 0: e
  247. *** Failers
  248. No match
  249. athing
  250. No match
  251. fthing
  252. No match
  253. /^[^ab\]cde]/
  254. fthing
  255. 0: f
  256. [thing
  257. 0: [
  258. \\thing
  259. 0: \
  260. *** Failers
  261. 0: *
  262. athing
  263. No match
  264. bthing
  265. No match
  266. ]thing
  267. No match
  268. cthing
  269. No match
  270. dthing
  271. No match
  272. ething
  273. No match
  274. /^[^]cde]/
  275. athing
  276. 0: a
  277. fthing
  278. 0: f
  279. *** Failers
  280. 0: *
  281. ]thing
  282. No match
  283. cthing
  284. No match
  285. dthing
  286. No match
  287. ething
  288. No match
  289. /^\�/
  290. 0: \x81
  291. /^ÿ/
  292. ÿ
  293. 0: \xff
  294. /^[0-9]+$/
  295. 0
  296. 0: 0
  297. 1
  298. 0: 1
  299. 2
  300. 0: 2
  301. 3
  302. 0: 3
  303. 4
  304. 0: 4
  305. 5
  306. 0: 5
  307. 6
  308. 0: 6
  309. 7
  310. 0: 7
  311. 8
  312. 0: 8
  313. 9
  314. 0: 9
  315. 10
  316. 0: 10
  317. 100
  318. 0: 100
  319. *** Failers
  320. No match
  321. abc
  322. No match
  323. /^.*nter/
  324. enter
  325. 0: enter
  326. inter
  327. 0: inter
  328. uponter
  329. 0: uponter
  330. /^xxx[0-9]+$/
  331. xxx0
  332. 0: xxx0
  333. xxx1234
  334. 0: xxx1234
  335. *** Failers
  336. No match
  337. xxx
  338. No match
  339. /^.+[0-9][0-9][0-9]$/
  340. x123
  341. 0: x123
  342. xx123
  343. 0: xx123
  344. 123456
  345. 0: 123456
  346. *** Failers
  347. No match
  348. 123
  349. No match
  350. x1234
  351. 0: x1234
  352. /^.+?[0-9][0-9][0-9]$/
  353. x123
  354. 0: x123
  355. xx123
  356. 0: xx123
  357. 123456
  358. 0: 123456
  359. *** Failers
  360. No match
  361. 123
  362. No match
  363. x1234
  364. 0: x1234
  365. /^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
  366. abc!pqr=apquxz.ixr.zzz.ac.uk
  367. 0: abc!pqr=apquxz.ixr.zzz.ac.uk
  368. 1: abc
  369. 2: pqr
  370. *** Failers
  371. No match
  372. !pqr=apquxz.ixr.zzz.ac.uk
  373. No match
  374. abc!=apquxz.ixr.zzz.ac.uk
  375. No match
  376. abc!pqr=apquxz:ixr.zzz.ac.uk
  377. No match
  378. abc!pqr=apquxz.ixr.zzz.ac.ukk
  379. No match
  380. /:/
  381. Well, we need a colon: somewhere
  382. 0: :
  383. *** Fail if we don't
  384. No match
  385. /([\da-f:]+)$/i
  386. 0abc
  387. 0: 0abc
  388. 1: 0abc
  389. abc
  390. 0: abc
  391. 1: abc
  392. fed
  393. 0: fed
  394. 1: fed
  395. E
  396. 0: E
  397. 1: E
  398. ::
  399. 0: ::
  400. 1: ::
  401. 5f03:12C0::932e
  402. 0: 5f03:12C0::932e
  403. 1: 5f03:12C0::932e
  404. fed def
  405. 0: def
  406. 1: def
  407. Any old stuff
  408. 0: ff
  409. 1: ff
  410. *** Failers
  411. No match
  412. 0zzz
  413. No match
  414. gzzz
  415. No match
  416. fed\x20
  417. No match
  418. Any old rubbish
  419. No match
  420. /^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
  421. .1.2.3
  422. 0: .1.2.3
  423. 1: 1
  424. 2: 2
  425. 3: 3
  426. A.12.123.0
  427. 0: A.12.123.0
  428. 1: 12
  429. 2: 123
  430. 3: 0
  431. *** Failers
  432. No match
  433. .1.2.3333
  434. No match
  435. 1.2.3
  436. No match
  437. 1234.2.3
  438. No match
  439. /^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
  440. 1 IN SOA non-sp1 non-sp2(
  441. 0: 1 IN SOA non-sp1 non-sp2(
  442. 1: 1
  443. 2: non-sp1
  444. 3: non-sp2
  445. 1 IN SOA non-sp1 non-sp2 (
  446. 0: 1 IN SOA non-sp1 non-sp2 (
  447. 1: 1
  448. 2: non-sp1
  449. 3: non-sp2
  450. *** Failers
  451. No match
  452. 1IN SOA non-sp1 non-sp2(
  453. No match
  454. /^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
  455. a.
  456. 0: a.
  457. Z.
  458. 0: Z.
  459. 2.
  460. 0: 2.
  461. ab-c.pq-r.
  462. 0: ab-c.pq-r.
  463. 1: .pq-r
  464. sxk.zzz.ac.uk.
  465. 0: sxk.zzz.ac.uk.
  466. 1: .uk
  467. x-.y-.
  468. 0: x-.y-.
  469. 1: .y-
  470. *** Failers
  471. No match
  472. -abc.peq.
  473. No match
  474. /^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
  475. *.a
  476. 0: *.a
  477. *.b0-a
  478. 0: *.b0-a
  479. 1: 0-a
  480. *.c3-b.c
  481. 0: *.c3-b.c
  482. 1: 3-b
  483. 2: .c
  484. *.c-a.b-c
  485. 0: *.c-a.b-c
  486. 1: -a
  487. 2: .b-c
  488. 3: -c
  489. *** Failers
  490. No match
  491. *.0
  492. No match
  493. *.a-
  494. No match
  495. *.a-b.c-
  496. No match
  497. *.c-a.0-c
  498. No match
  499. /^(?=ab(de))(abd)(e)/
  500. abde
  501. 0: abde
  502. 1: de
  503. 2: abd
  504. 3: e
  505. /^(?!(ab)de|x)(abd)(f)/
  506. abdf
  507. 0: abdf
  508. 1: <unset>
  509. 2: abd
  510. 3: f
  511. /^(?=(ab(cd)))(ab)/
  512. abcd
  513. 0: ab
  514. 1: abcd
  515. 2: cd
  516. 3: ab
  517. /^[\da-f](\.[\da-f])*$/i
  518. a.b.c.d
  519. 0: a.b.c.d
  520. 1: .d
  521. A.B.C.D
  522. 0: A.B.C.D
  523. 1: .D
  524. a.b.c.1.2.3.C
  525. 0: a.b.c.1.2.3.C
  526. 1: .C
  527. /^\".*\"\s*(;.*)?$/
  528. \"1234\"
  529. 0: "1234"
  530. \"abcd\" ;
  531. 0: "abcd" ;
  532. 1: ;
  533. \"\" ; rhubarb
  534. 0: "" ; rhubarb
  535. 1: ; rhubarb
  536. *** Failers
  537. No match
  538. \"1234\" : things
  539. No match
  540. /^$/
  541. \
  542. 0:
  543. *** Failers
  544. No match
  545. / ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x
  546. ab c
  547. 0: ab c
  548. *** Failers
  549. No match
  550. abc
  551. No match
  552. ab cde
  553. No match
  554. /(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/
  555. ab c
  556. 0: ab c
  557. *** Failers
  558. No match
  559. abc
  560. No match
  561. ab cde
  562. No match
  563. /^ a\ b[c ]d $/x
  564. a bcd
  565. 0: a bcd
  566. a b d
  567. 0: a b d
  568. *** Failers
  569. No match
  570. abcd
  571. No match
  572. ab d
  573. No match
  574. /^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
  575. abcdefhijklm
  576. 0: abcdefhijklm
  577. 1: abc
  578. 2: bc
  579. 3: c
  580. 4: def
  581. 5: ef
  582. 6: f
  583. 7: hij
  584. 8: ij
  585. 9: j
  586. 10: klm
  587. 11: lm
  588. 12: m
  589. /^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
  590. abcdefhijklm
  591. 0: abcdefhijklm
  592. 1: bc
  593. 2: c
  594. 3: ef
  595. 4: f
  596. 5: ij
  597. 6: j
  598. 7: lm
  599. 8: m
  600. /^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
  601. a+ Z0+\x08\n\x1d\x12
  602. 0: a+ Z0+\x08\x0a\x1d\x12
  603. /^[.^$|()*+?{,}]+/
  604. .^\$(*+)|{?,?}
  605. 0: .^$(*+)|{?,?}
  606. /^a*\w/
  607. z
  608. 0: z
  609. az
  610. 0: az
  611. aaaz
  612. 0: aaaz
  613. a
  614. 0: a
  615. aa
  616. 0: aa
  617. aaaa
  618. 0: aaaa
  619. a+
  620. 0: a
  621. aa+
  622. 0: aa
  623. /^a*?\w/
  624. z
  625. 0: z
  626. az
  627. 0: a
  628. aaaz
  629. 0: a
  630. a
  631. 0: a
  632. aa
  633. 0: a
  634. aaaa
  635. 0: a
  636. a+
  637. 0: a
  638. aa+
  639. 0: a
  640. /^a+\w/
  641. az
  642. 0: az
  643. aaaz
  644. 0: aaaz
  645. aa
  646. 0: aa
  647. aaaa
  648. 0: aaaa
  649. aa+
  650. 0: aa
  651. /^a+?\w/
  652. az
  653. 0: az
  654. aaaz
  655. 0: aa
  656. aa
  657. 0: aa
  658. aaaa
  659. 0: aa
  660. aa+
  661. 0: aa
  662. /^\d{8}\w{2,}/
  663. 1234567890
  664. 0: 1234567890
  665. 12345678ab
  666. 0: 12345678ab
  667. 12345678__
  668. 0: 12345678__
  669. *** Failers
  670. No match
  671. 1234567
  672. No match
  673. /^[aeiou\d]{4,5}$/
  674. uoie
  675. 0: uoie
  676. 1234
  677. 0: 1234
  678. 12345
  679. 0: 12345
  680. aaaaa
  681. 0: aaaaa
  682. *** Failers
  683. No match
  684. 123456
  685. No match
  686. /^[aeiou\d]{4,5}?/
  687. uoie
  688. 0: uoie
  689. 1234
  690. 0: 1234
  691. 12345
  692. 0: 1234
  693. aaaaa
  694. 0: aaaa
  695. 123456
  696. 0: 1234
  697. /\A(abc|def)=(\1){2,3}\Z/
  698. abc=abcabc
  699. 0: abc=abcabc
  700. 1: abc
  701. 2: abc
  702. def=defdefdef
  703. 0: def=defdefdef
  704. 1: def
  705. 2: def
  706. *** Failers
  707. No match
  708. abc=defdef
  709. No match
  710. /^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/
  711. abcdefghijkcda2
  712. 0: abcdefghijkcda2
  713. 1: a
  714. 2: b
  715. 3: c
  716. 4: d
  717. 5: e
  718. 6: f
  719. 7: g
  720. 8: h
  721. 9: i
  722. 10: j
  723. 11: k
  724. 12: cd
  725. abcdefghijkkkkcda2
  726. 0: abcdefghijkkkkcda2
  727. 1: a
  728. 2: b
  729. 3: c
  730. 4: d
  731. 5: e
  732. 6: f
  733. 7: g
  734. 8: h
  735. 9: i
  736. 10: j
  737. 11: k
  738. 12: cd
  739. /(cat(a(ract|tonic)|erpillar)) \1()2(3)/
  740. cataract cataract23
  741. 0: cataract cataract23
  742. 1: cataract
  743. 2: aract
  744. 3: ract
  745. 4:
  746. 5: 3
  747. catatonic catatonic23
  748. 0: catatonic catatonic23
  749. 1: catatonic
  750. 2: atonic
  751. 3: tonic
  752. 4:
  753. 5: 3
  754. caterpillar caterpillar23
  755. 0: caterpillar caterpillar23
  756. 1: caterpillar
  757. 2: erpillar
  758. 3: <unset>
  759. 4:
  760. 5: 3
  761. /^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]/
  762. From abcd Mon Sep 01 12:33:02 1997
  763. 0: From abcd Mon Sep 01 12:33
  764. 1: abcd
  765. /^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
  766. From abcd Mon Sep 01 12:33:02 1997
  767. 0: From abcd Mon Sep 01 12:33
  768. 1: Sep
  769. From abcd Mon Sep 1 12:33:02 1997
  770. 0: From abcd Mon Sep 1 12:33
  771. 1: Sep
  772. *** Failers
  773. No match
  774. From abcd Sep 01 12:33:02 1997
  775. No match
  776. /^12.34/s
  777. 12\n34
  778. 0: 12\x0a34
  779. 12\r34
  780. 0: 12\x0d34
  781. /\w+(?=\t)/
  782. the quick brown\t fox
  783. 0: brown
  784. /foo(?!bar)(.*)/
  785. foobar is foolish see?
  786. 0: foolish see?
  787. 1: lish see?
  788. /(?:(?!foo)...|^.{0,2})bar(.*)/
  789. foobar crowbar etc
  790. 0: rowbar etc
  791. 1: etc
  792. barrel
  793. 0: barrel
  794. 1: rel
  795. 2barrel
  796. 0: 2barrel
  797. 1: rel
  798. A barrel
  799. 0: A barrel
  800. 1: rel
  801. /^(\D*)(?=\d)(?!123)/
  802. abc456
  803. 0: abc
  804. 1: abc
  805. *** Failers
  806. No match
  807. abc123
  808. No match
  809. /^1234(?# test newlines
  810. inside)/
  811. 1234
  812. 0: 1234
  813. /^1234 #comment in extended re
  814. /x
  815. 1234
  816. 0: 1234
  817. /#rhubarb
  818. abcd/x
  819. abcd
  820. 0: abcd
  821. /^abcd#rhubarb/x
  822. abcd
  823. 0: abcd
  824. /^(a)\1{2,3}(.)/
  825. aaab
  826. 0: aaab
  827. 1: a
  828. 2: b
  829. aaaab
  830. 0: aaaab
  831. 1: a
  832. 2: b
  833. aaaaab
  834. 0: aaaaa
  835. 1: a
  836. 2: a
  837. aaaaaab
  838. 0: aaaaa
  839. 1: a
  840. 2: a
  841. /(?!^)abc/
  842. the abc
  843. 0: abc
  844. *** Failers
  845. No match
  846. abc
  847. No match
  848. /(?=^)abc/
  849. abc
  850. 0: abc
  851. *** Failers
  852. No match
  853. the abc
  854. No match
  855. /^[ab]{1,3}(ab*|b)/
  856. aabbbbb
  857. 0: aabb
  858. 1: b
  859. /^[ab]{1,3}?(ab*|b)/
  860. aabbbbb
  861. 0: aabbbbb
  862. 1: abbbbb
  863. /^[ab]{1,3}?(ab*?|b)/
  864. aabbbbb
  865. 0: aa
  866. 1: a
  867. /^[ab]{1,3}(ab*?|b)/
  868. aabbbbb
  869. 0: aabb
  870. 1: b
  871. / (?: [\040\t] | \(
  872. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  873. \) )* # optional leading comment
  874. (?: (?:
  875. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  876. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  877. |
  878. " (?: # opening quote...
  879. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  880. | # or
  881. \\ [^\x80-\xff] # Escaped something (something != CR)
  882. )* " # closing quote
  883. ) # initial word
  884. (?: (?: [\040\t] | \(
  885. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  886. \) )* \. (?: [\040\t] | \(
  887. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  888. \) )* (?:
  889. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  890. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  891. |
  892. " (?: # opening quote...
  893. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  894. | # or
  895. \\ [^\x80-\xff] # Escaped something (something != CR)
  896. )* " # closing quote
  897. ) )* # further okay, if led by a period
  898. (?: [\040\t] | \(
  899. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  900. \) )* @ (?: [\040\t] | \(
  901. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  902. \) )* (?:
  903. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  904. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  905. | \[ # [
  906. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  907. \] # ]
  908. ) # initial subdomain
  909. (?: #
  910. (?: [\040\t] | \(
  911. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  912. \) )* \. # if led by a period...
  913. (?: [\040\t] | \(
  914. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  915. \) )* (?:
  916. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  917. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  918. | \[ # [
  919. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  920. \] # ]
  921. ) # ...further okay
  922. )*
  923. # address
  924. | # or
  925. (?:
  926. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  927. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  928. |
  929. " (?: # opening quote...
  930. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  931. | # or
  932. \\ [^\x80-\xff] # Escaped something (something != CR)
  933. )* " # closing quote
  934. ) # one word, optionally followed by....
  935. (?:
  936. [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or...
  937. \(
  938. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  939. \) | # comments, or...
  940. " (?: # opening quote...
  941. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  942. | # or
  943. \\ [^\x80-\xff] # Escaped something (something != CR)
  944. )* " # closing quote
  945. # quoted strings
  946. )*
  947. < (?: [\040\t] | \(
  948. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  949. \) )* # leading <
  950. (?: @ (?: [\040\t] | \(
  951. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  952. \) )* (?:
  953. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  954. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  955. | \[ # [
  956. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  957. \] # ]
  958. ) # initial subdomain
  959. (?: #
  960. (?: [\040\t] | \(
  961. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  962. \) )* \. # if led by a period...
  963. (?: [\040\t] | \(
  964. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  965. \) )* (?:
  966. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  967. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  968. | \[ # [
  969. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  970. \] # ]
  971. ) # ...further okay
  972. )*
  973. (?: (?: [\040\t] | \(
  974. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  975. \) )* , (?: [\040\t] | \(
  976. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  977. \) )* @ (?: [\040\t] | \(
  978. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  979. \) )* (?:
  980. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  981. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  982. | \[ # [
  983. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  984. \] # ]
  985. ) # initial subdomain
  986. (?: #
  987. (?: [\040\t] | \(
  988. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  989. \) )* \. # if led by a period...
  990. (?: [\040\t] | \(
  991. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  992. \) )* (?:
  993. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  994. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  995. | \[ # [
  996. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  997. \] # ]
  998. ) # ...further okay
  999. )*
  1000. )* # further okay, if led by comma
  1001. : # closing colon
  1002. (?: [\040\t] | \(
  1003. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1004. \) )* )? # optional route
  1005. (?:
  1006. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1007. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1008. |
  1009. " (?: # opening quote...
  1010. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  1011. | # or
  1012. \\ [^\x80-\xff] # Escaped something (something != CR)
  1013. )* " # closing quote
  1014. ) # initial word
  1015. (?: (?: [\040\t] | \(
  1016. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1017. \) )* \. (?: [\040\t] | \(
  1018. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1019. \) )* (?:
  1020. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1021. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1022. |
  1023. " (?: # opening quote...
  1024. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  1025. | # or
  1026. \\ [^\x80-\xff] # Escaped something (something != CR)
  1027. )* " # closing quote
  1028. ) )* # further okay, if led by a period
  1029. (?: [\040\t] | \(
  1030. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1031. \) )* @ (?: [\040\t] | \(
  1032. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1033. \) )* (?:
  1034. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1035. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1036. | \[ # [
  1037. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1038. \] # ]
  1039. ) # initial subdomain
  1040. (?: #
  1041. (?: [\040\t] | \(
  1042. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1043. \) )* \. # if led by a period...
  1044. (?: [\040\t] | \(
  1045. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1046. \) )* (?:
  1047. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1048. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1049. | \[ # [
  1050. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1051. \] # ]
  1052. ) # ...further okay
  1053. )*
  1054. # address spec
  1055. (?: [\040\t] | \(
  1056. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1057. \) )* > # trailing >
  1058. # name and address
  1059. ) (?: [\040\t] | \(
  1060. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1061. \) )* # optional trailing comment
  1062. /x
  1063. Alan Other <user\@dom.ain>
  1064. 0: Alan Other <user@dom.ain>
  1065. <user\@dom.ain>
  1066. 0: user@dom.ain
  1067. user\@dom.ain
  1068. 0: user@dom.ain
  1069. \"A. Other\" <user.1234\@dom.ain> (a comment)
  1070. 0: "A. Other" <user.1234@dom.ain> (a comment)
  1071. A. Other <user.1234\@dom.ain> (a comment)
  1072. 0: Other <user.1234@dom.ain> (a comment)
  1073. \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
  1074. 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
  1075. A missing angle <user\@some.where
  1076. 0: user@some.where
  1077. *** Failers
  1078. No match
  1079. The quick brown fox
  1080. No match
  1081. /[\040\t]* # Nab whitespace.
  1082. (?:
  1083. \( # (
  1084. [^\\\x80-\xff\n\015()] * # normal*
  1085. (?: # (
  1086. (?: \\ [^\x80-\xff] |
  1087. \( # (
  1088. [^\\\x80-\xff\n\015()] * # normal*
  1089. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1090. \) # )
  1091. ) # special
  1092. [^\\\x80-\xff\n\015()] * # normal*
  1093. )* # )*
  1094. \) # )
  1095. [\040\t]* )* # If comment found, allow more spaces.
  1096. # optional leading comment
  1097. (?:
  1098. (?:
  1099. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1100. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1101. # Atom
  1102. | # or
  1103. " # "
  1104. [^\\\x80-\xff\n\015"] * # normal
  1105. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1106. " # "
  1107. # Quoted string
  1108. )
  1109. [\040\t]* # Nab whitespace.
  1110. (?:
  1111. \( # (
  1112. [^\\\x80-\xff\n\015()] * # normal*
  1113. (?: # (
  1114. (?: \\ [^\x80-\xff] |
  1115. \( # (
  1116. [^\\\x80-\xff\n\015()] * # normal*
  1117. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1118. \) # )
  1119. ) # special
  1120. [^\\\x80-\xff\n\015()] * # normal*
  1121. )* # )*
  1122. \) # )
  1123. [\040\t]* )* # If comment found, allow more spaces.
  1124. (?:
  1125. \.
  1126. [\040\t]* # Nab whitespace.
  1127. (?:
  1128. \( # (
  1129. [^\\\x80-\xff\n\015()] * # normal*
  1130. (?: # (
  1131. (?: \\ [^\x80-\xff] |
  1132. \( # (
  1133. [^\\\x80-\xff\n\015()] * # normal*
  1134. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1135. \) # )
  1136. ) # special
  1137. [^\\\x80-\xff\n\015()] * # normal*
  1138. )* # )*
  1139. \) # )
  1140. [\040\t]* )* # If comment found, allow more spaces.
  1141. (?:
  1142. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1143. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1144. # Atom
  1145. | # or
  1146. " # "
  1147. [^\\\x80-\xff\n\015"] * # normal
  1148. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1149. " # "
  1150. # Quoted string
  1151. )
  1152. [\040\t]* # Nab whitespace.
  1153. (?:
  1154. \( # (
  1155. [^\\\x80-\xff\n\015()] * # normal*
  1156. (?: # (
  1157. (?: \\ [^\x80-\xff] |
  1158. \( # (
  1159. [^\\\x80-\xff\n\015()] * # normal*
  1160. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1161. \) # )
  1162. ) # special
  1163. [^\\\x80-\xff\n\015()] * # normal*
  1164. )* # )*
  1165. \) # )
  1166. [\040\t]* )* # If comment found, allow more spaces.
  1167. # additional words
  1168. )*
  1169. @
  1170. [\040\t]* # Nab whitespace.
  1171. (?:
  1172. \( # (
  1173. [^\\\x80-\xff\n\015()] * # normal*
  1174. (?: # (
  1175. (?: \\ [^\x80-\xff] |
  1176. \( # (
  1177. [^\\\x80-\xff\n\015()] * # normal*
  1178. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1179. \) # )
  1180. ) # special
  1181. [^\\\x80-\xff\n\015()] * # normal*
  1182. )* # )*
  1183. \) # )
  1184. [\040\t]* )* # If comment found, allow more spaces.
  1185. (?:
  1186. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1187. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1188. |
  1189. \[ # [
  1190. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1191. \] # ]
  1192. )
  1193. [\040\t]* # Nab whitespace.
  1194. (?:
  1195. \( # (
  1196. [^\\\x80-\xff\n\015()] * # normal*
  1197. (?: # (
  1198. (?: \\ [^\x80-\xff] |
  1199. \( # (
  1200. [^\\\x80-\xff\n\015()] * # normal*
  1201. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1202. \) # )
  1203. ) # special
  1204. [^\\\x80-\xff\n\015()] * # normal*
  1205. )* # )*
  1206. \) # )
  1207. [\040\t]* )* # If comment found, allow more spaces.
  1208. # optional trailing comments
  1209. (?:
  1210. \.
  1211. [\040\t]* # Nab whitespace.
  1212. (?:
  1213. \( # (
  1214. [^\\\x80-\xff\n\015()] * # normal*
  1215. (?: # (
  1216. (?: \\ [^\x80-\xff] |
  1217. \( # (
  1218. [^\\\x80-\xff\n\015()] * # normal*
  1219. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1220. \) # )
  1221. ) # special
  1222. [^\\\x80-\xff\n\015()] * # normal*
  1223. )* # )*
  1224. \) # )
  1225. [\040\t]* )* # If comment found, allow more spaces.
  1226. (?:
  1227. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1228. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1229. |
  1230. \[ # [
  1231. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1232. \] # ]
  1233. )
  1234. [\040\t]* # Nab whitespace.
  1235. (?:
  1236. \( # (
  1237. [^\\\x80-\xff\n\015()] * # normal*
  1238. (?: # (
  1239. (?: \\ [^\x80-\xff] |
  1240. \( # (
  1241. [^\\\x80-\xff\n\015()] * # normal*
  1242. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1243. \) # )
  1244. ) # special
  1245. [^\\\x80-\xff\n\015()] * # normal*
  1246. )* # )*
  1247. \) # )
  1248. [\040\t]* )* # If comment found, allow more spaces.
  1249. # optional trailing comments
  1250. )*
  1251. # address
  1252. | # or
  1253. (?:
  1254. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1255. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1256. # Atom
  1257. | # or
  1258. " # "
  1259. [^\\\x80-\xff\n\015"] * # normal
  1260. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1261. " # "
  1262. # Quoted string
  1263. )
  1264. # leading word
  1265. [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces
  1266. (?:
  1267. (?:
  1268. \( # (
  1269. [^\\\x80-\xff\n\015()] * # normal*
  1270. (?: # (
  1271. (?: \\ [^\x80-\xff] |
  1272. \( # (
  1273. [^\\\x80-\xff\n\015()] * # normal*
  1274. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1275. \) # )
  1276. ) # special
  1277. [^\\\x80-\xff\n\015()] * # normal*
  1278. )* # )*
  1279. \) # )
  1280. |
  1281. " # "
  1282. [^\\\x80-\xff\n\015"] * # normal
  1283. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1284. " # "
  1285. ) # "special" comment or quoted string
  1286. [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal"
  1287. )*
  1288. <
  1289. [\040\t]* # Nab whitespace.
  1290. (?:
  1291. \( # (
  1292. [^\\\x80-\xff\n\015()] * # normal*
  1293. (?: # (
  1294. (?: \\ [^\x80-\xff] |
  1295. \( # (
  1296. [^\\\x80-\xff\n\015()] * # normal*
  1297. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1298. \) # )
  1299. ) # special
  1300. [^\\\x80-\xff\n\015()] * # normal*
  1301. )* # )*
  1302. \) # )
  1303. [\040\t]* )* # If comment found, allow more spaces.
  1304. # <
  1305. (?:
  1306. @
  1307. [\040\t]* # Nab whitespace.
  1308. (?:
  1309. \( # (
  1310. [^\\\x80-\xff\n\015()] * # normal*
  1311. (?: # (
  1312. (?: \\ [^\x80-\xff] |
  1313. \( # (
  1314. [^\\\x80-\xff\n\015()] * # normal*
  1315. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1316. \) # )
  1317. ) # special
  1318. [^\\\x80-\xff\n\015()] * # normal*
  1319. )* # )*
  1320. \) # )
  1321. [\040\t]* )* # If comment found, allow more spaces.
  1322. (?:
  1323. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1324. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1325. |
  1326. \[ # [
  1327. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1328. \] # ]
  1329. )
  1330. [\040\t]* # Nab whitespace.
  1331. (?:
  1332. \( # (
  1333. [^\\\x80-\xff\n\015()] * # normal*
  1334. (?: # (
  1335. (?: \\ [^\x80-\xff] |
  1336. \( # (
  1337. [^\\\x80-\xff\n\015()] * # normal*
  1338. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1339. \) # )
  1340. ) # special
  1341. [^\\\x80-\xff\n\015()] * # normal*
  1342. )* # )*
  1343. \) # )
  1344. [\040\t]* )* # If comment found, allow more spaces.
  1345. # optional trailing comments
  1346. (?:
  1347. \.
  1348. [\040\t]* # Nab whitespace.
  1349. (?:
  1350. \( # (
  1351. [^\\\x80-\xff\n\015()] * # normal*
  1352. (?: # (
  1353. (?: \\ [^\x80-\xff] |
  1354. \( # (
  1355. [^\\\x80-\xff\n\015()] * # normal*
  1356. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1357. \) # )
  1358. ) # special
  1359. [^\\\x80-\xff\n\015()] * # normal*
  1360. )* # )*
  1361. \) # )
  1362. [\040\t]* )* # If comment found, allow more spaces.
  1363. (?:
  1364. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1365. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1366. |
  1367. \[ # [
  1368. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1369. \] # ]
  1370. )
  1371. [\040\t]* # Nab whitespace.
  1372. (?:
  1373. \( # (
  1374. [^\\\x80-\xff\n\015()] * # normal*
  1375. (?: # (
  1376. (?: \\ [^\x80-\xff] |
  1377. \( # (
  1378. [^\\\x80-\xff\n\015()] * # normal*
  1379. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1380. \) # )
  1381. ) # special
  1382. [^\\\x80-\xff\n\015()] * # normal*
  1383. )* # )*
  1384. \) # )
  1385. [\040\t]* )* # If comment found, allow more spaces.
  1386. # optional trailing comments
  1387. )*
  1388. (?: ,
  1389. [\040\t]* # Nab whitespace.
  1390. (?:
  1391. \( # (
  1392. [^\\\x80-\xff\n\015()] * # normal*
  1393. (?: # (
  1394. (?: \\ [^\x80-\xff] |
  1395. \( # (
  1396. [^\\\x80-\xff\n\015()] * # normal*
  1397. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1398. \) # )
  1399. ) # special
  1400. [^\\\x80-\xff\n\015()] * # normal*
  1401. )* # )*
  1402. \) # )
  1403. [\040\t]* )* # If comment found, allow more spaces.
  1404. @
  1405. [\040\t]* # Nab whitespace.
  1406. (?:
  1407. \( # (
  1408. [^\\\x80-\xff\n\015()] * # normal*
  1409. (?: # (
  1410. (?: \\ [^\x80-\xff] |
  1411. \( # (
  1412. [^\\\x80-\xff\n\015()] * # normal*
  1413. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1414. \) # )
  1415. ) # special
  1416. [^\\\x80-\xff\n\015()] * # normal*
  1417. )* # )*
  1418. \) # )
  1419. [\040\t]* )* # If comment found, allow more spaces.
  1420. (?:
  1421. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1422. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1423. |
  1424. \[ # [
  1425. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1426. \] # ]
  1427. )
  1428. [\040\t]* # Nab whitespace.
  1429. (?:
  1430. \( # (
  1431. [^\\\x80-\xff\n\015()] * # normal*
  1432. (?: # (
  1433. (?: \\ [^\x80-\xff] |
  1434. \( # (
  1435. [^\\\x80-\xff\n\015()] * # normal*
  1436. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1437. \) # )
  1438. ) # special
  1439. [^\\\x80-\xff\n\015()] * # normal*
  1440. )* # )*
  1441. \) # )
  1442. [\040\t]* )* # If comment found, allow more spaces.
  1443. # optional trailing comments
  1444. (?:
  1445. \.
  1446. [\040\t]* # Nab whitespace.
  1447. (?:
  1448. \( # (
  1449. [^\\\x80-\xff\n\015()] * # normal*
  1450. (?: # (
  1451. (?: \\ [^\x80-\xff] |
  1452. \( # (
  1453. [^\\\x80-\xff\n\015()] * # normal*
  1454. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1455. \) # )
  1456. ) # special
  1457. [^\\\x80-\xff\n\015()] * # normal*
  1458. )* # )*
  1459. \) # )
  1460. [\040\t]* )* # If comment found, allow more spaces.
  1461. (?:
  1462. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1463. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1464. |
  1465. \[ # [
  1466. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1467. \] # ]
  1468. )
  1469. [\040\t]* # Nab whitespace.
  1470. (?:
  1471. \( # (
  1472. [^\\\x80-\xff\n\015()] * # normal*
  1473. (?: # (
  1474. (?: \\ [^\x80-\xff] |
  1475. \( # (
  1476. [^\\\x80-\xff\n\015()] * # normal*
  1477. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1478. \) # )
  1479. ) # special
  1480. [^\\\x80-\xff\n\015()] * # normal*
  1481. )* # )*
  1482. \) # )
  1483. [\040\t]* )* # If comment found, allow more spaces.
  1484. # optional trailing comments
  1485. )*
  1486. )* # additional domains
  1487. :
  1488. [\040\t]* # Nab whitespace.
  1489. (?:
  1490. \( # (
  1491. [^\\\x80-\xff\n\015()] * # normal*
  1492. (?: # (
  1493. (?: \\ [^\x80-\xff] |
  1494. \( # (
  1495. [^\\\x80-\xff\n\015()] * # normal*
  1496. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1497. \) # )
  1498. ) # special
  1499. [^\\\x80-\xff\n\015()] * # normal*
  1500. )* # )*
  1501. \) # )
  1502. [\040\t]* )* # If comment found, allow more spaces.
  1503. # optional trailing comments
  1504. )? # optional route
  1505. (?:
  1506. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1507. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1508. # Atom
  1509. | # or
  1510. " # "
  1511. [^\\\x80-\xff\n\015"] * # normal
  1512. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1513. " # "
  1514. # Quoted string
  1515. )
  1516. [\040\t]* # Nab whitespace.
  1517. (?:
  1518. \( # (
  1519. [^\\\x80-\xff\n\015()] * # normal*
  1520. (?: # (
  1521. (?: \\ [^\x80-\xff] |
  1522. \( # (
  1523. [^\\\x80-\xff\n\015()] * # normal*
  1524. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1525. \) # )
  1526. ) # special
  1527. [^\\\x80-\xff\n\015()] * # normal*
  1528. )* # )*
  1529. \) # )
  1530. [\040\t]* )* # If comment found, allow more spaces.
  1531. (?:
  1532. \.
  1533. [\040\t]* # Nab whitespace.
  1534. (?:
  1535. \( # (
  1536. [^\\\x80-\xff\n\015()] * # normal*
  1537. (?: # (
  1538. (?: \\ [^\x80-\xff] |
  1539. \( # (
  1540. [^\\\x80-\xff\n\015()] * # normal*
  1541. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1542. \) # )
  1543. ) # special
  1544. [^\\\x80-\xff\n\015()] * # normal*
  1545. )* # )*
  1546. \) # )
  1547. [\040\t]* )* # If comment found, allow more spaces.
  1548. (?:
  1549. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1550. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1551. # Atom
  1552. | # or
  1553. " # "
  1554. [^\\\x80-\xff\n\015"] * # normal
  1555. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1556. " # "
  1557. # Quoted string
  1558. )
  1559. [\040\t]* # Nab whitespace.
  1560. (?:
  1561. \( # (
  1562. [^\\\x80-\xff\n\015()] * # normal*
  1563. (?: # (
  1564. (?: \\ [^\x80-\xff] |
  1565. \( # (
  1566. [^\\\x80-\xff\n\015()] * # normal*
  1567. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1568. \) # )
  1569. ) # special
  1570. [^\\\x80-\xff\n\015()] * # normal*
  1571. )* # )*
  1572. \) # )
  1573. [\040\t]* )* # If comment found, allow more spaces.
  1574. # additional words
  1575. )*
  1576. @
  1577. [\040\t]* # Nab whitespace.
  1578. (?:
  1579. \( # (
  1580. [^\\\x80-\xff\n\015()] * # normal*
  1581. (?: # (
  1582. (?: \\ [^\x80-\xff] |
  1583. \( # (
  1584. [^\\\x80-\xff\n\015()] * # normal*
  1585. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1586. \) # )
  1587. ) # special
  1588. [^\\\x80-\xff\n\015()] * # normal*
  1589. )* # )*
  1590. \) # )
  1591. [\040\t]* )* # If comment found, allow more spaces.
  1592. (?:
  1593. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1594. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1595. |
  1596. \[ # [
  1597. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1598. \] # ]
  1599. )
  1600. [\040\t]* # Nab whitespace.
  1601. (?:
  1602. \( # (
  1603. [^\\\x80-\xff\n\015()] * # normal*
  1604. (?: # (
  1605. (?: \\ [^\x80-\xff] |
  1606. \( # (
  1607. [^\\\x80-\xff\n\015()] * # normal*
  1608. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1609. \) # )
  1610. ) # special
  1611. [^\\\x80-\xff\n\015()] * # normal*
  1612. )* # )*
  1613. \) # )
  1614. [\040\t]* )* # If comment found, allow more spaces.
  1615. # optional trailing comments
  1616. (?:
  1617. \.
  1618. [\040\t]* # Nab whitespace.
  1619. (?:
  1620. \( # (
  1621. [^\\\x80-\xff\n\015()] * # normal*
  1622. (?: # (
  1623. (?: \\ [^\x80-\xff] |
  1624. \( # (
  1625. [^\\\x80-\xff\n\015()] * # normal*
  1626. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1627. \) # )
  1628. ) # special
  1629. [^\\\x80-\xff\n\015()] * # normal*
  1630. )* # )*
  1631. \) # )
  1632. [\040\t]* )* # If comment found, allow more spaces.
  1633. (?:
  1634. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1635. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1636. |
  1637. \[ # [
  1638. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1639. \] # ]
  1640. )
  1641. [\040\t]* # Nab whitespace.
  1642. (?:
  1643. \( # (
  1644. [^\\\x80-\xff\n\015()] * # normal*
  1645. (?: # (
  1646. (?: \\ [^\x80-\xff] |
  1647. \( # (
  1648. [^\\\x80-\xff\n\015()] * # normal*
  1649. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1650. \) # )
  1651. ) # special
  1652. [^\\\x80-\xff\n\015()] * # normal*
  1653. )* # )*
  1654. \) # )
  1655. [\040\t]* )* # If comment found, allow more spaces.
  1656. # optional trailing comments
  1657. )*
  1658. # address spec
  1659. > # >
  1660. # name and address
  1661. )
  1662. /x
  1663. Alan Other <user\@dom.ain>
  1664. 0: Alan Other <user@dom.ain>
  1665. <user\@dom.ain>
  1666. 0: user@dom.ain
  1667. user\@dom.ain
  1668. 0: user@dom.ain
  1669. \"A. Other\" <user.1234\@dom.ain> (a comment)
  1670. 0: "A. Other" <user.1234@dom.ain>
  1671. A. Other <user.1234\@dom.ain> (a comment)
  1672. 0: Other <user.1234@dom.ain>
  1673. \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
  1674. 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
  1675. A missing angle <user\@some.where
  1676. 0: user@some.where
  1677. *** Failers
  1678. No match
  1679. The quick brown fox
  1680. No match
  1681. /abc\0def\00pqr\000xyz\0000AB/
  1682. abc\0def\00pqr\000xyz\0000AB
  1683. 0: abc\x00def\x00pqr\x00xyz\x000AB
  1684. abc456 abc\0def\00pqr\000xyz\0000ABCDE
  1685. 0: abc\x00def\x00pqr\x00xyz\x000AB
  1686. /abc\x0def\x00pqr\x000xyz\x0000AB/
  1687. abc\x0def\x00pqr\x000xyz\x0000AB
  1688. 0: abc\x0def\x00pqr\x000xyz\x0000AB
  1689. abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
  1690. 0: abc\x0def\x00pqr\x000xyz\x0000AB
  1691. /^[\000-\037]/
  1692. \0A
  1693. 0: \x00
  1694. \01B
  1695. 0: \x01
  1696. \037C
  1697. 0: \x1f
  1698. /\0*/
  1699. \0\0\0\0
  1700. 0: \x00\x00\x00\x00
  1701. /A\x0{2,3}Z/
  1702. The A\x0\x0Z
  1703. 0: A\x00\x00Z
  1704. An A\0\x0\0Z
  1705. 0: A\x00\x00\x00Z
  1706. *** Failers
  1707. No match
  1708. A\0Z
  1709. No match
  1710. A\0\x0\0\x0Z
  1711. No match
  1712. /^(cow|)\1(bell)/
  1713. cowcowbell
  1714. 0: cowcowbell
  1715. 1: cow
  1716. 2: bell
  1717. bell
  1718. 0: bell
  1719. 1:
  1720. 2: bell
  1721. *** Failers
  1722. No match
  1723. cowbell
  1724. No match
  1725. /^\s/
  1726. \040abc
  1727. 0:
  1728. \x0cabc
  1729. 0: \x0c
  1730. \nabc
  1731. 0: \x0a
  1732. \rabc
  1733. 0: \x0d
  1734. \tabc
  1735. 0: \x09
  1736. *** Failers
  1737. No match
  1738. abc
  1739. No match
  1740. /^a b
  1741. c/x
  1742. abc
  1743. 0: abc
  1744. /^(a|)\1*b/
  1745. ab
  1746. 0: ab
  1747. 1: a
  1748. aaaab
  1749. 0: aaaab
  1750. 1: a
  1751. b
  1752. 0: b
  1753. 1:
  1754. *** Failers
  1755. No match
  1756. acb
  1757. No match
  1758. /^(a|)\1+b/
  1759. aab
  1760. 0: aab
  1761. 1: a
  1762. aaaab
  1763. 0: aaaab
  1764. 1: a
  1765. b
  1766. 0: b
  1767. 1:
  1768. *** Failers
  1769. No match
  1770. ab
  1771. No match
  1772. /^(a|)\1?b/
  1773. ab
  1774. 0: ab
  1775. 1: a
  1776. aab
  1777. 0: aab
  1778. 1: a
  1779. b
  1780. 0: b
  1781. 1:
  1782. *** Failers
  1783. No match
  1784. acb
  1785. No match
  1786. /^(a|)\1{2}b/
  1787. aaab
  1788. 0: aaab
  1789. 1: a
  1790. b
  1791. 0: b
  1792. 1:
  1793. *** Failers
  1794. No match
  1795. ab
  1796. No match
  1797. aab
  1798. No match
  1799. aaaab
  1800. No match
  1801. /^(a|)\1{2,3}b/
  1802. aaab
  1803. 0: aaab
  1804. 1: a
  1805. aaaab
  1806. 0: aaaab
  1807. 1: a
  1808. b
  1809. 0: b
  1810. 1:
  1811. *** Failers
  1812. No match
  1813. ab
  1814. No match
  1815. aab
  1816. No match
  1817. aaaaab
  1818. No match
  1819. /ab{1,3}bc/
  1820. abbbbc
  1821. 0: abbbbc
  1822. abbbc
  1823. 0: abbbc
  1824. abbc
  1825. 0: abbc
  1826. *** Failers
  1827. No match
  1828. abc
  1829. No match
  1830. abbbbbc
  1831. No match
  1832. /([^.]*)\.([^:]*):[T ]+(.*)/
  1833. track1.title:TBlah blah blah
  1834. 0: track1.title:TBlah blah blah
  1835. 1: track1
  1836. 2: title
  1837. 3: Blah blah blah
  1838. /([^.]*)\.([^:]*):[T ]+(.*)/i
  1839. track1.title:TBlah blah blah
  1840. 0: track1.title:TBlah blah blah
  1841. 1: track1
  1842. 2: title
  1843. 3: Blah blah blah
  1844. /([^.]*)\.([^:]*):[t ]+(.*)/i
  1845. track1.title:TBlah blah blah
  1846. 0: track1.title:TBlah blah blah
  1847. 1: track1
  1848. 2: title
  1849. 3: Blah blah blah
  1850. /^[W-c]+$/
  1851. WXY_^abc
  1852. 0: WXY_^abc
  1853. *** Failers
  1854. No match
  1855. wxy
  1856. No match
  1857. /^[W-c]+$/i
  1858. WXY_^abc
  1859. 0: WXY_^abc
  1860. wxy_^ABC
  1861. 0: wxy_^ABC
  1862. /^[\x3f-\x5F]+$/i
  1863. WXY_^abc
  1864. 0: WXY_^abc
  1865. wxy_^ABC
  1866. 0: wxy_^ABC
  1867. /^abc$/m
  1868. abc
  1869. 0: abc
  1870. qqq\nabc
  1871. 0: abc
  1872. abc\nzzz
  1873. 0: abc
  1874. qqq\nabc\nzzz
  1875. 0: abc
  1876. /^abc$/
  1877. abc
  1878. 0: abc
  1879. *** Failers
  1880. No match
  1881. qqq\nabc
  1882. No match
  1883. abc\nzzz
  1884. No match
  1885. qqq\nabc\nzzz
  1886. No match
  1887. /\Aabc\Z/m
  1888. abc
  1889. 0: abc
  1890. abc\n
  1891. 0: abc
  1892. *** Failers
  1893. No match
  1894. qqq\nabc
  1895. No match
  1896. abc\nzzz
  1897. No match
  1898. qqq\nabc\nzzz
  1899. No match
  1900. /\A(.)*\Z/s
  1901. abc\ndef
  1902. 0: abc\x0adef
  1903. 1: f
  1904. /\A(.)*\Z/m
  1905. *** Failers
  1906. 0: *** Failers
  1907. 1: s
  1908. abc\ndef
  1909. No match
  1910. /(?:b)|(?::+)/
  1911. b::c
  1912. 0: b
  1913. c::b
  1914. 0: ::
  1915. /[-az]+/
  1916. az-
  1917. 0: az-
  1918. *** Failers
  1919. 0: a
  1920. b
  1921. No match
  1922. /[az-]+/
  1923. za-
  1924. 0: za-
  1925. *** Failers
  1926. 0: a
  1927. b
  1928. No match
  1929. /[a\-z]+/
  1930. a-z
  1931. 0: a-z
  1932. *** Failers
  1933. 0: a
  1934. b
  1935. No match
  1936. /[a-z]+/
  1937. abcdxyz
  1938. 0: abcdxyz
  1939. /[\d-]+/
  1940. 12-34
  1941. 0: 12-34
  1942. *** Failers
  1943. No match
  1944. aaa
  1945. No match
  1946. /[\d-z]+/
  1947. 12-34z
  1948. 0: 12-34z
  1949. *** Failers
  1950. No match
  1951. aaa
  1952. No match
  1953. /\x5c/
  1954. \\
  1955. 0: \
  1956. /\x20Z/
  1957. the Zoo
  1958. 0: Z
  1959. *** Failers
  1960. No match
  1961. Zulu
  1962. No match
  1963. /(abc)\1/i
  1964. abcabc
  1965. 0: abcabc
  1966. 1: abc
  1967. ABCabc
  1968. 0: ABCabc
  1969. 1: ABC
  1970. abcABC
  1971. 0: abcABC
  1972. 1: abc
  1973. /ab{3cd/
  1974. ab{3cd
  1975. 0: ab{3cd
  1976. /ab{3,cd/
  1977. ab{3,cd
  1978. 0: ab{3,cd
  1979. /ab{3,4a}cd/
  1980. ab{3,4a}cd
  1981. 0: ab{3,4a}cd
  1982. /{4,5a}bc/
  1983. {4,5a}bc
  1984. 0: {4,5a}bc
  1985. /abc$/
  1986. abc
  1987. 0: abc
  1988. abc\n
  1989. 0: abc
  1990. *** Failers
  1991. No match
  1992. abc\ndef
  1993. No match
  1994. /(abc)\123/
  1995. abc\x53
  1996. 0: abcS
  1997. 1: abc
  1998. /(abc)\223/
  1999. abc\x93
  2000. 0: abc\x93
  2001. 1: abc
  2002. /(abc)\323/
  2003. abc\xd3
  2004. 0: abc\xd3
  2005. 1: abc
  2006. /(abc)\100/
  2007. abc\x40
  2008. 0: abc@
  2009. 1: abc
  2010. abc\100
  2011. 0: abc@
  2012. 1: abc
  2013. /(abc)\1000/
  2014. abc\x400
  2015. 0: abc@0
  2016. 1: abc
  2017. abc\x40\x30
  2018. 0: abc@0
  2019. 1: abc
  2020. abc\1000
  2021. 0: abc@0
  2022. 1: abc
  2023. abc\100\x30
  2024. 0: abc@0
  2025. 1: abc
  2026. abc\100\060
  2027. 0: abc@0
  2028. 1: abc
  2029. abc\100\60
  2030. 0: abc@0
  2031. 1: abc
  2032. /^A\8B\9C$/
  2033. A8B9C
  2034. 0: A8B9C
  2035. *** Failers
  2036. No match
  2037. A\08B\09C
  2038. No match
  2039. /^(A)(B)(C)(D)(E)(F)(G)(H)(I)\8\9$/
  2040. ABCDEFGHIHI
  2041. 0: ABCDEFGHIHI
  2042. 1: A
  2043. 2: B
  2044. 3: C
  2045. 4: D
  2046. 5: E
  2047. 6: F
  2048. 7: G
  2049. 8: H
  2050. 9: I
  2051. /^[A\8B\9C]+$/
  2052. A8B9C
  2053. 0: A8B9C
  2054. *** Failers
  2055. No match
  2056. A8B9C\x00
  2057. No match
  2058. /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
  2059. abcdefghijkllS
  2060. 0: abcdefghijkllS
  2061. 1: a
  2062. 2: b
  2063. 3: c
  2064. 4: d
  2065. 5: e
  2066. 6: f
  2067. 7: g
  2068. 8: h
  2069. 9: i
  2070. 10: j
  2071. 11: k
  2072. 12: l
  2073. /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
  2074. abcdefghijk\12S
  2075. 0: abcdefghijk\x0aS
  2076. 1: a
  2077. 2: b
  2078. 3: c
  2079. 4: d
  2080. 5: e
  2081. 6: f
  2082. 7: g
  2083. 8: h
  2084. 9: i
  2085. 10: j
  2086. 11: k
  2087. /ab\idef/
  2088. abidef
  2089. 0: abidef
  2090. /a{0}bc/
  2091. bc
  2092. 0: bc
  2093. /(a|(bc)){0,0}?xyz/
  2094. xyz
  2095. 0: xyz
  2096. /abc[\10]de/
  2097. abc\010de
  2098. 0: abc\x08de
  2099. /abc[\1]de/
  2100. abc\1de
  2101. 0: abc\x01de
  2102. /(abc)[\1]de/
  2103. abc\1de
  2104. 0: abc\x01de
  2105. 1: abc
  2106. /(?s)a.b/
  2107. a\nb
  2108. 0: a\x0ab
  2109. /^([^a])([^\b])([^c]*)([^d]{3,4})/
  2110. baNOTccccd
  2111. 0: baNOTcccc
  2112. 1: b
  2113. 2: a
  2114. 3: NOT
  2115. 4: cccc
  2116. baNOTcccd
  2117. 0: baNOTccc
  2118. 1: b
  2119. 2: a
  2120. 3: NOT
  2121. 4: ccc
  2122. baNOTccd
  2123. 0: baNOTcc
  2124. 1: b
  2125. 2: a
  2126. 3: NO
  2127. 4: Tcc
  2128. bacccd
  2129. 0: baccc
  2130. 1: b
  2131. 2: a
  2132. 3:
  2133. 4: ccc
  2134. *** Failers
  2135. 0: *** Failers
  2136. 1: *
  2137. 2: *
  2138. 3: * Fail
  2139. 4: ers
  2140. anything
  2141. No match
  2142. b\bc
  2143. No match
  2144. baccd
  2145. No match
  2146. /[^a]/
  2147. Abc
  2148. 0: A
  2149. /[^a]/i
  2150. Abc
  2151. 0: b
  2152. /[^a]+/
  2153. AAAaAbc
  2154. 0: AAA
  2155. /[^a]+/i
  2156. AAAaAbc
  2157. 0: bc
  2158. /[^a]+/
  2159. bbb\nccc
  2160. 0: bbb\x0accc
  2161. /[^k]$/
  2162. abc
  2163. 0: c
  2164. *** Failers
  2165. 0: s
  2166. abk
  2167. No match
  2168. /[^k]{2,3}$/
  2169. abc
  2170. 0: abc
  2171. kbc
  2172. 0: bc
  2173. kabc
  2174. 0: abc
  2175. *** Failers
  2176. 0: ers
  2177. abk
  2178. No match
  2179. akb
  2180. No match
  2181. akk
  2182. No match
  2183. /^\d{8,}\@.+[^k]$/
  2184. 12345678\@a.b.c.d
  2185. 0: 12345678@a.b.c.d
  2186. 123456789\@x.y.z
  2187. 0: 123456789@x.y.z
  2188. *** Failers
  2189. No match
  2190. 12345678\@x.y.uk
  2191. No match
  2192. 1234567\@a.b.c.d
  2193. No match
  2194. /(a)\1{8,}/
  2195. aaaaaaaaa
  2196. 0: aaaaaaaaa
  2197. 1: a
  2198. aaaaaaaaaa
  2199. 0: aaaaaaaaaa
  2200. 1: a
  2201. *** Failers
  2202. No match
  2203. aaaaaaa
  2204. No match
  2205. /[^a]/
  2206. aaaabcd
  2207. 0: b
  2208. aaAabcd
  2209. 0: A
  2210. /[^a]/i
  2211. aaaabcd
  2212. 0: b
  2213. aaAabcd
  2214. 0: b
  2215. /[^az]/
  2216. aaaabcd
  2217. 0: b
  2218. aaAabcd
  2219. 0: A
  2220. /[^az]/i
  2221. aaaabcd
  2222. 0: b
  2223. aaAabcd
  2224. 0: b
  2225. /\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/
  2226. \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377
  2227. 0: \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff
  2228. /P[^*]TAIRE[^*]{1,6}?LL/
  2229. xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
  2230. 0: PSTAIREISLL
  2231. /P[^*]TAIRE[^*]{1,}?LL/
  2232. xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
  2233. 0: PSTAIREISLL
  2234. /(\.\d\d[1-9]?)\d+/
  2235. 1.230003938
  2236. 0: .230003938
  2237. 1: .23
  2238. 1.875000282
  2239. 0: .875000282
  2240. 1: .875
  2241. 1.235
  2242. 0: .235
  2243. 1: .23
  2244. /(\.\d\d((?=0)|\d(?=\d)))/
  2245. 1.230003938
  2246. 0: .23
  2247. 1: .23
  2248. 2:
  2249. 1.875000282
  2250. 0: .875
  2251. 1: .875
  2252. 2: 5
  2253. *** Failers
  2254. No match
  2255. 1.235
  2256. No match
  2257. /a(?)b/
  2258. ab
  2259. 0: ab
  2260. /\b(foo)\s+(\w+)/i
  2261. Food is on the foo table
  2262. 0: foo table
  2263. 1: foo
  2264. 2: table
  2265. /foo(.*)bar/
  2266. The food is under the bar in the barn.
  2267. 0: food is under the bar in the bar
  2268. 1: d is under the bar in the
  2269. /foo(.*?)bar/
  2270. The food is under the bar in the barn.
  2271. 0: food is under the bar
  2272. 1: d is under the
  2273. /(.*)(\d*)/
  2274. I have 2 numbers: 53147
  2275. 0: I have 2 numbers: 53147
  2276. 1: I have 2 numbers: 53147
  2277. 2:
  2278. /(.*)(\d+)/
  2279. I have 2 numbers: 53147
  2280. 0: I have 2 numbers: 53147
  2281. 1: I have 2 numbers: 5314
  2282. 2: 7
  2283. /(.*?)(\d*)/
  2284. I have 2 numbers: 53147
  2285. 0:
  2286. 1:
  2287. 2:
  2288. /(.*?)(\d+)/
  2289. I have 2 numbers: 53147
  2290. 0: I have 2
  2291. 1: I have
  2292. 2: 2
  2293. /(.*)(\d+)$/
  2294. I have 2 numbers: 53147
  2295. 0: I have 2 numbers: 53147
  2296. 1: I have 2 numbers: 5314
  2297. 2: 7
  2298. /(.*?)(\d+)$/
  2299. I have 2 numbers: 53147
  2300. 0: I have 2 numbers: 53147
  2301. 1: I have 2 numbers:
  2302. 2: 53147
  2303. /(.*)\b(\d+)$/
  2304. I have 2 numbers: 53147
  2305. 0: I have 2 numbers: 53147
  2306. 1: I have 2 numbers:
  2307. 2: 53147
  2308. /(.*\D)(\d+)$/
  2309. I have 2 numbers: 53147
  2310. 0: I have 2 numbers: 53147
  2311. 1: I have 2 numbers:
  2312. 2: 53147
  2313. /^\D*(?!123)/
  2314. ABC123
  2315. 0: AB
  2316. /^(\D*)(?=\d)(?!123)/
  2317. ABC445
  2318. 0: ABC
  2319. 1: ABC
  2320. *** Failers
  2321. No match
  2322. ABC123
  2323. No match
  2324. /^[W-]46]/
  2325. W46]789
  2326. 0: W46]
  2327. -46]789
  2328. 0: -46]
  2329. *** Failers
  2330. No match
  2331. Wall
  2332. No match
  2333. Zebra
  2334. No match
  2335. 42
  2336. No match
  2337. [abcd]
  2338. No match
  2339. ]abcd[
  2340. No match
  2341. /^[W-\]46]/
  2342. W46]789
  2343. 0: W
  2344. Wall
  2345. 0: W
  2346. Zebra
  2347. 0: Z
  2348. Xylophone
  2349. 0: X
  2350. 42
  2351. 0: 4
  2352. [abcd]
  2353. 0: [
  2354. ]abcd[
  2355. 0: ]
  2356. \\backslash
  2357. 0: \
  2358. *** Failers
  2359. No match
  2360. -46]789
  2361. No match
  2362. well
  2363. No match
  2364. /\d\d\/\d\d\/\d\d\d\d/
  2365. 01/01/2000
  2366. 0: 01/01/2000
  2367. /word (?:[a-zA-Z0-9]+ ){0,10}otherword/
  2368. word cat dog elephant mussel cow horse canary baboon snake shark otherword
  2369. 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
  2370. word cat dog elephant mussel cow horse canary baboon snake shark
  2371. No match
  2372. /word (?:[a-zA-Z0-9]+ ){0,300}otherword/
  2373. word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
  2374. No match
  2375. /^(a){0,0}/
  2376. bcd
  2377. 0:
  2378. abc
  2379. 0:
  2380. aab
  2381. 0:
  2382. /^(a){0,1}/
  2383. bcd
  2384. 0:
  2385. abc
  2386. 0: a
  2387. 1: a
  2388. aab
  2389. 0: a
  2390. 1: a
  2391. /^(a){0,2}/
  2392. bcd
  2393. 0:
  2394. abc
  2395. 0: a
  2396. 1: a
  2397. aab
  2398. 0: aa
  2399. 1: a
  2400. /^(a){0,3}/
  2401. bcd
  2402. 0:
  2403. abc
  2404. 0: a
  2405. 1: a
  2406. aab
  2407. 0: aa
  2408. 1: a
  2409. aaa
  2410. 0: aaa
  2411. 1: a
  2412. /^(a){0,}/
  2413. bcd
  2414. 0:
  2415. abc
  2416. 0: a
  2417. 1: a
  2418. aab
  2419. 0: aa
  2420. 1: a
  2421. aaa
  2422. 0: aaa
  2423. 1: a
  2424. aaaaaaaa
  2425. 0: aaaaaaaa
  2426. 1: a
  2427. /^(a){1,1}/
  2428. bcd
  2429. No match
  2430. abc
  2431. 0: a
  2432. 1: a
  2433. aab
  2434. 0: a
  2435. 1: a
  2436. /^(a){1,2}/
  2437. bcd
  2438. No match
  2439. abc
  2440. 0: a
  2441. 1: a
  2442. aab
  2443. 0: aa
  2444. 1: a
  2445. /^(a){1,3}/
  2446. bcd
  2447. No match
  2448. abc
  2449. 0: a
  2450. 1: a
  2451. aab
  2452. 0: aa
  2453. 1: a
  2454. aaa
  2455. 0: aaa
  2456. 1: a
  2457. /^(a){1,}/
  2458. bcd
  2459. No match
  2460. abc
  2461. 0: a
  2462. 1: a
  2463. aab
  2464. 0: aa
  2465. 1: a
  2466. aaa
  2467. 0: aaa
  2468. 1: a
  2469. aaaaaaaa
  2470. 0: aaaaaaaa
  2471. 1: a
  2472. /.*\.gif/
  2473. borfle\nbib.gif\nno
  2474. 0: bib.gif
  2475. /.{0,}\.gif/
  2476. borfle\nbib.gif\nno
  2477. 0: bib.gif
  2478. /.*\.gif/m
  2479. borfle\nbib.gif\nno
  2480. 0: bib.gif
  2481. /.*\.gif/s
  2482. borfle\nbib.gif\nno
  2483. 0: borfle\x0abib.gif
  2484. /.*\.gif/ms
  2485. borfle\nbib.gif\nno
  2486. 0: borfle\x0abib.gif
  2487. /.*$/
  2488. borfle\nbib.gif\nno
  2489. 0: no
  2490. /.*$/m
  2491. borfle\nbib.gif\nno
  2492. 0: borfle
  2493. /.*$/s
  2494. borfle\nbib.gif\nno
  2495. 0: borfle\x0abib.gif\x0ano
  2496. /.*$/ms
  2497. borfle\nbib.gif\nno
  2498. 0: borfle\x0abib.gif\x0ano
  2499. /.*$/
  2500. borfle\nbib.gif\nno\n
  2501. 0: no
  2502. /.*$/m
  2503. borfle\nbib.gif\nno\n
  2504. 0: borfle
  2505. /.*$/s
  2506. borfle\nbib.gif\nno\n
  2507. 0: borfle\x0abib.gif\x0ano\x0a
  2508. /.*$/ms
  2509. borfle\nbib.gif\nno\n
  2510. 0: borfle\x0abib.gif\x0ano\x0a
  2511. /(.*X|^B)/
  2512. abcde\n1234Xyz
  2513. 0: 1234X
  2514. 1: 1234X
  2515. BarFoo
  2516. 0: B
  2517. 1: B
  2518. *** Failers
  2519. No match
  2520. abcde\nBar
  2521. No match
  2522. /(.*X|^B)/m
  2523. abcde\n1234Xyz
  2524. 0: 1234X
  2525. 1: 1234X
  2526. BarFoo
  2527. 0: B
  2528. 1: B
  2529. abcde\nBar
  2530. 0: B
  2531. 1: B
  2532. /(.*X|^B)/s
  2533. abcde\n1234Xyz
  2534. 0: abcde\x0a1234X
  2535. 1: abcde\x0a1234X
  2536. BarFoo
  2537. 0: B
  2538. 1: B
  2539. *** Failers
  2540. No match
  2541. abcde\nBar
  2542. No match
  2543. /(.*X|^B)/ms
  2544. abcde\n1234Xyz
  2545. 0: abcde\x0a1234X
  2546. 1: abcde\x0a1234X
  2547. BarFoo
  2548. 0: B
  2549. 1: B
  2550. abcde\nBar
  2551. 0: B
  2552. 1: B
  2553. /(?s)(.*X|^B)/
  2554. abcde\n1234Xyz
  2555. 0: abcde\x0a1234X
  2556. 1: abcde\x0a1234X
  2557. BarFoo
  2558. 0: B
  2559. 1: B
  2560. *** Failers
  2561. No match
  2562. abcde\nBar
  2563. No match
  2564. /(?s:.*X|^B)/
  2565. abcde\n1234Xyz
  2566. 0: abcde\x0a1234X
  2567. BarFoo
  2568. 0: B
  2569. *** Failers
  2570. No match
  2571. abcde\nBar
  2572. No match
  2573. /^.*B/
  2574. **** Failers
  2575. No match
  2576. abc\nB
  2577. No match
  2578. /(?s)^.*B/
  2579. abc\nB
  2580. 0: abc\x0aB
  2581. /(?m)^.*B/
  2582. abc\nB
  2583. 0: B
  2584. /(?ms)^.*B/
  2585. abc\nB
  2586. 0: abc\x0aB
  2587. /(?ms)^B/
  2588. abc\nB
  2589. 0: B
  2590. /(?s)B$/
  2591. B\n
  2592. 0: B
  2593. /^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
  2594. 123456654321
  2595. 0: 123456654321
  2596. /^\d\d\d\d\d\d\d\d\d\d\d\d/
  2597. 123456654321
  2598. 0: 123456654321
  2599. /^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
  2600. 123456654321
  2601. 0: 123456654321
  2602. /^[abc]{12}/
  2603. abcabcabcabc
  2604. 0: abcabcabcabc
  2605. /^[a-c]{12}/
  2606. abcabcabcabc
  2607. 0: abcabcabcabc
  2608. /^(a|b|c){12}/
  2609. abcabcabcabc
  2610. 0: abcabcabcabc
  2611. 1: c
  2612. /^[abcdefghijklmnopqrstuvwxy0123456789]/
  2613. n
  2614. 0: n
  2615. *** Failers
  2616. No match
  2617. z
  2618. No match
  2619. /abcde{0,0}/
  2620. abcd
  2621. 0: abcd
  2622. *** Failers
  2623. No match
  2624. abce
  2625. No match
  2626. /ab[cd]{0,0}e/
  2627. abe
  2628. 0: abe
  2629. *** Failers
  2630. No match
  2631. abcde
  2632. No match
  2633. /ab(c){0,0}d/
  2634. abd
  2635. 0: abd
  2636. *** Failers
  2637. No match
  2638. abcd
  2639. No match
  2640. /a(b*)/
  2641. a
  2642. 0: a
  2643. 1:
  2644. ab
  2645. 0: ab
  2646. 1: b
  2647. abbbb
  2648. 0: abbbb
  2649. 1: bbbb
  2650. *** Failers
  2651. 0: a
  2652. 1:
  2653. bbbbb
  2654. No match
  2655. /ab\d{0}e/
  2656. abe
  2657. 0: abe
  2658. *** Failers
  2659. No match
  2660. ab1e
  2661. No match
  2662. /"([^\\"]+|\\.)*"/
  2663. the \"quick\" brown fox
  2664. 0: "quick"
  2665. 1: quick
  2666. \"the \\\"quick\\\" brown fox\"
  2667. 0: "the \"quick\" brown fox"
  2668. 1: brown fox
  2669. /.*?/g+
  2670. abc
  2671. 0:
  2672. 0+ abc
  2673. 0: a
  2674. 0+ bc
  2675. 0:
  2676. 0+ bc
  2677. 0: b
  2678. 0+ c
  2679. 0:
  2680. 0+ c
  2681. 0: c
  2682. 0+
  2683. 0:
  2684. 0+
  2685. /\b/g+
  2686. abc
  2687. 0:
  2688. 0+ abc
  2689. 0:
  2690. 0+
  2691. /\b/+g
  2692. abc
  2693. 0:
  2694. 0+ abc
  2695. 0:
  2696. 0+
  2697. //g
  2698. abc
  2699. 0:
  2700. 0:
  2701. 0:
  2702. 0:
  2703. /<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/is
  2704. <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
  2705. 0: <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
  2706. 1: BGCOLOR='#DBE9E9'
  2707. 2: align=left valign=top
  2708. 3: 43.
  2709. 4: <a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)
  2710. 5:
  2711. 6:
  2712. 7: <unset>
  2713. 8: align=left valign=top
  2714. 9: Lega lstaff.com
  2715. 10: align=left valign=top
  2716. 11: CA - Statewide
  2717. /a[^a]b/
  2718. acb
  2719. 0: acb
  2720. a\nb
  2721. 0: a\x0ab
  2722. /a.b/
  2723. acb
  2724. 0: acb
  2725. *** Failers
  2726. No match
  2727. a\nb
  2728. No match
  2729. /a[^a]b/s
  2730. acb
  2731. 0: acb
  2732. a\nb
  2733. 0: a\x0ab
  2734. /a.b/s
  2735. acb
  2736. 0: acb
  2737. a\nb
  2738. 0: a\x0ab
  2739. /^(b+?|a){1,2}?c/
  2740. bac
  2741. 0: bac
  2742. 1: a
  2743. bbac
  2744. 0: bbac
  2745. 1: a
  2746. bbbac
  2747. 0: bbbac
  2748. 1: a
  2749. bbbbac
  2750. 0: bbbbac
  2751. 1: a
  2752. bbbbbac
  2753. 0: bbbbbac
  2754. 1: a
  2755. /^(b+|a){1,2}?c/
  2756. bac
  2757. 0: bac
  2758. 1: a
  2759. bbac
  2760. 0: bbac
  2761. 1: a
  2762. bbbac
  2763. 0: bbbac
  2764. 1: a
  2765. bbbbac
  2766. 0: bbbbac
  2767. 1: a
  2768. bbbbbac
  2769. 0: bbbbbac
  2770. 1: a
  2771. /(?!\A)x/m
  2772. x\nb\n
  2773. No match
  2774. a\bx\n
  2775. 0: x
  2776. /\x0{ab}/
  2777. \0{ab}
  2778. 0: \x00{ab}
  2779. /(A|B)*?CD/
  2780. CD
  2781. 0: CD
  2782. /(A|B)*CD/
  2783. CD
  2784. 0: CD
  2785. /(AB)*?\1/
  2786. ABABAB
  2787. 0: ABAB
  2788. 1: AB
  2789. /(AB)*\1/
  2790. ABABAB
  2791. 0: ABABAB
  2792. 1: AB
  2793. /(?<!bar)foo/
  2794. foo
  2795. 0: foo
  2796. catfood
  2797. 0: foo
  2798. arfootle
  2799. 0: foo
  2800. rfoosh
  2801. 0: foo
  2802. *** Failers
  2803. No match
  2804. barfoo
  2805. No match
  2806. towbarfoo
  2807. No match
  2808. /\w{3}(?<!bar)foo/
  2809. catfood
  2810. 0: catfoo
  2811. *** Failers
  2812. No match
  2813. foo
  2814. No match
  2815. barfoo
  2816. No match
  2817. towbarfoo
  2818. No match
  2819. /(?<=(foo)a)bar/
  2820. fooabar
  2821. 0: bar
  2822. 1: foo
  2823. *** Failers
  2824. No match
  2825. bar
  2826. No match
  2827. foobbar
  2828. No match
  2829. /\Aabc\z/m
  2830. abc
  2831. 0: abc
  2832. *** Failers
  2833. No match
  2834. abc\n
  2835. No match
  2836. qqq\nabc
  2837. No match
  2838. abc\nzzz
  2839. No match
  2840. qqq\nabc\nzzz
  2841. No match
  2842. "(?>.*/)foo"
  2843. /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
  2844. No match
  2845. "(?>.*/)foo"
  2846. /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
  2847. 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
  2848. /(?>(\.\d\d[1-9]?))\d+/
  2849. 1.230003938
  2850. 0: .230003938
  2851. 1: .23
  2852. 1.875000282
  2853. 0: .875000282
  2854. 1: .875
  2855. *** Failers
  2856. No match
  2857. 1.235
  2858. No match
  2859. /^((?>\w+)|(?>\s+))*$/
  2860. now is the time for all good men to come to the aid of the party
  2861. 0: now is the time for all good men to come to the aid of the party
  2862. 1: party
  2863. *** Failers
  2864. No match
  2865. this is not a line with only words and spaces!
  2866. No match
  2867. /(\d+)(\w)/
  2868. 12345a
  2869. 0: 12345a
  2870. 1: 12345
  2871. 2: a
  2872. 12345+
  2873. 0: 12345
  2874. 1: 1234
  2875. 2: 5
  2876. /((?>\d+))(\w)/
  2877. 12345a
  2878. 0: 12345a
  2879. 1: 12345
  2880. 2: a
  2881. *** Failers
  2882. No match
  2883. 12345+
  2884. No match
  2885. /(?>a+)b/
  2886. aaab
  2887. 0: aaab
  2888. /((?>a+)b)/
  2889. aaab
  2890. 0: aaab
  2891. 1: aaab
  2892. /(?>(a+))b/
  2893. aaab
  2894. 0: aaab
  2895. 1: aaa
  2896. /(?>b)+/
  2897. aaabbbccc
  2898. 0: bbb
  2899. /(?>a+|b+|c+)*c/
  2900. aaabbbbccccd
  2901. 0: aaabbbbc
  2902. /((?>[^()]+)|\([^()]*\))+/
  2903. ((abc(ade)ufh()()x
  2904. 0: abc(ade)ufh()()x
  2905. 1: x
  2906. /\(((?>[^()]+)|\([^()]+\))+\)/
  2907. (abc)
  2908. 0: (abc)
  2909. 1: abc
  2910. (abc(def)xyz)
  2911. 0: (abc(def)xyz)
  2912. 1: xyz
  2913. *** Failers
  2914. No match
  2915. ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  2916. No match
  2917. /a(?-i)b/i
  2918. ab
  2919. 0: ab
  2920. Ab
  2921. 0: Ab
  2922. *** Failers
  2923. No match
  2924. aB
  2925. No match
  2926. AB
  2927. No match
  2928. /(a (?x)b c)d e/
  2929. a bcd e
  2930. 0: a bcd e
  2931. 1: a bc
  2932. *** Failers
  2933. No match
  2934. a b cd e
  2935. No match
  2936. abcd e
  2937. No match
  2938. a bcde
  2939. No match
  2940. /(a b(?x)c d (?-x)e f)/
  2941. a bcde f
  2942. 0: a bcde f
  2943. 1: a bcde f
  2944. *** Failers
  2945. No match
  2946. abcdef
  2947. No match
  2948. /(a(?i)b)c/
  2949. abc
  2950. 0: abc
  2951. 1: ab
  2952. aBc
  2953. 0: aBc
  2954. 1: aB
  2955. *** Failers
  2956. No match
  2957. abC
  2958. No match
  2959. aBC
  2960. No match
  2961. Abc
  2962. No match
  2963. ABc
  2964. No match
  2965. ABC
  2966. No match
  2967. AbC
  2968. No match
  2969. /a(?i:b)c/
  2970. abc
  2971. 0: abc
  2972. aBc
  2973. 0: aBc
  2974. *** Failers
  2975. No match
  2976. ABC
  2977. No match
  2978. abC
  2979. No match
  2980. aBC
  2981. No match
  2982. /a(?i:b)*c/
  2983. aBc
  2984. 0: aBc
  2985. aBBc
  2986. 0: aBBc
  2987. *** Failers
  2988. No match
  2989. aBC
  2990. No match
  2991. aBBC
  2992. No match
  2993. /a(?=b(?i)c)\w\wd/
  2994. abcd
  2995. 0: abcd
  2996. abCd
  2997. 0: abCd
  2998. *** Failers
  2999. No match
  3000. aBCd
  3001. No match
  3002. abcD
  3003. No match
  3004. /(?s-i:more.*than).*million/i
  3005. more than million
  3006. 0: more than million
  3007. more than MILLION
  3008. 0: more than MILLION
  3009. more \n than Million
  3010. 0: more \x0a than Million
  3011. *** Failers
  3012. No match
  3013. MORE THAN MILLION
  3014. No match
  3015. more \n than \n million
  3016. No match
  3017. /(?:(?s-i)more.*than).*million/i
  3018. more than million
  3019. 0: more than million
  3020. more than MILLION
  3021. 0: more than MILLION
  3022. more \n than Million
  3023. 0: more \x0a than Million
  3024. *** Failers
  3025. No match
  3026. MORE THAN MILLION
  3027. No match
  3028. more \n than \n million
  3029. No match
  3030. /(?>a(?i)b+)+c/
  3031. abc
  3032. 0: abc
  3033. aBbc
  3034. 0: aBbc
  3035. aBBc
  3036. 0: aBBc
  3037. *** Failers
  3038. No match
  3039. Abc
  3040. No match
  3041. abAb
  3042. No match
  3043. abbC
  3044. No match
  3045. /(?=a(?i)b)\w\wc/
  3046. abc
  3047. 0: abc
  3048. aBc
  3049. 0: aBc
  3050. *** Failers
  3051. No match
  3052. Ab
  3053. No match
  3054. abC
  3055. No match
  3056. aBC
  3057. No match
  3058. /(?<=a(?i)b)(\w\w)c/
  3059. abxxc
  3060. 0: xxc
  3061. 1: xx
  3062. aBxxc
  3063. 0: xxc
  3064. 1: xx
  3065. *** Failers
  3066. No match
  3067. Abxxc
  3068. No match
  3069. ABxxc
  3070. No match
  3071. abxxC
  3072. No match
  3073. /(?:(a)|b)(?(1)A|B)/
  3074. aA
  3075. 0: aA
  3076. 1: a
  3077. bB
  3078. 0: bB
  3079. *** Failers
  3080. No match
  3081. aB
  3082. No match
  3083. bA
  3084. No match
  3085. /^(a)?(?(1)a|b)+$/
  3086. aa
  3087. 0: aa
  3088. 1: a
  3089. b
  3090. 0: b
  3091. bb
  3092. 0: bb
  3093. *** Failers
  3094. No match
  3095. ab
  3096. No match
  3097. /^(?(?=abc)\w{3}:|\d\d)$/
  3098. abc:
  3099. 0: abc:
  3100. 12
  3101. 0: 12
  3102. *** Failers
  3103. No match
  3104. 123
  3105. No match
  3106. xyz
  3107. No match
  3108. /^(?(?!abc)\d\d|\w{3}:)$/
  3109. abc:
  3110. 0: abc:
  3111. 12
  3112. 0: 12
  3113. *** Failers
  3114. No match
  3115. 123
  3116. No match
  3117. xyz
  3118. No match
  3119. /(?(?<=foo)bar|cat)/
  3120. foobar
  3121. 0: bar
  3122. cat
  3123. 0: cat
  3124. fcat
  3125. 0: cat
  3126. focat
  3127. 0: cat
  3128. *** Failers
  3129. No match
  3130. foocat
  3131. No match
  3132. /(?(?<!foo)cat|bar)/
  3133. foobar
  3134. 0: bar
  3135. cat
  3136. 0: cat
  3137. fcat
  3138. 0: cat
  3139. focat
  3140. 0: cat
  3141. *** Failers
  3142. No match
  3143. foocat
  3144. No match
  3145. /( \( )? [^()]+ (?(1) \) |) /x
  3146. abcd
  3147. 0: abcd
  3148. (abcd)
  3149. 0: (abcd)
  3150. 1: (
  3151. the quick (abcd) fox
  3152. 0: the quick
  3153. (abcd
  3154. 0: abcd
  3155. /( \( )? [^()]+ (?(1) \) ) /x
  3156. abcd
  3157. 0: abcd
  3158. (abcd)
  3159. 0: (abcd)
  3160. 1: (
  3161. the quick (abcd) fox
  3162. 0: the quick
  3163. (abcd
  3164. 0: abcd
  3165. /^(?(2)a|(1)(2))+$/
  3166. 12
  3167. 0: 12
  3168. 1: 1
  3169. 2: 2
  3170. 12a
  3171. 0: 12a
  3172. 1: 1
  3173. 2: 2
  3174. 12aa
  3175. 0: 12aa
  3176. 1: 1
  3177. 2: 2
  3178. *** Failers
  3179. No match
  3180. 1234
  3181. No match
  3182. /((?i)blah)\s+\1/
  3183. blah blah
  3184. 0: blah blah
  3185. 1: blah
  3186. BLAH BLAH
  3187. 0: BLAH BLAH
  3188. 1: BLAH
  3189. Blah Blah
  3190. 0: Blah Blah
  3191. 1: Blah
  3192. blaH blaH
  3193. 0: blaH blaH
  3194. 1: blaH
  3195. *** Failers
  3196. No match
  3197. blah BLAH
  3198. No match
  3199. Blah blah
  3200. No match
  3201. blaH blah
  3202. No match
  3203. /((?i)blah)\s+(?i:\1)/
  3204. blah blah
  3205. 0: blah blah
  3206. 1: blah
  3207. BLAH BLAH
  3208. 0: BLAH BLAH
  3209. 1: BLAH
  3210. Blah Blah
  3211. 0: Blah Blah
  3212. 1: Blah
  3213. blaH blaH
  3214. 0: blaH blaH
  3215. 1: blaH
  3216. blah BLAH
  3217. 0: blah BLAH
  3218. 1: blah
  3219. Blah blah
  3220. 0: Blah blah
  3221. 1: Blah
  3222. blaH blah
  3223. 0: blaH blah
  3224. 1: blaH
  3225. /(?>a*)*/
  3226. a
  3227. 0: a
  3228. aa
  3229. 0: aa
  3230. aaaa
  3231. 0: aaaa
  3232. /(abc|)+/
  3233. abc
  3234. 0: abc
  3235. 1:
  3236. abcabc
  3237. 0: abcabc
  3238. 1:
  3239. abcabcabc
  3240. 0: abcabcabc
  3241. 1:
  3242. xyz
  3243. 0:
  3244. 1:
  3245. /([a]*)*/
  3246. a
  3247. 0: a
  3248. 1:
  3249. aaaaa
  3250. 0: aaaaa
  3251. 1:
  3252. /([ab]*)*/
  3253. a
  3254. 0: a
  3255. 1:
  3256. b
  3257. 0: b
  3258. 1:
  3259. ababab
  3260. 0: ababab
  3261. 1:
  3262. aaaabcde
  3263. 0: aaaab
  3264. 1:
  3265. bbbb
  3266. 0: bbbb
  3267. 1:
  3268. /([^a]*)*/
  3269. b
  3270. 0: b
  3271. 1:
  3272. bbbb
  3273. 0: bbbb
  3274. 1:
  3275. aaa
  3276. 0:
  3277. 1:
  3278. /([^ab]*)*/
  3279. cccc
  3280. 0: cccc
  3281. 1:
  3282. abab
  3283. 0:
  3284. 1:
  3285. /([a]*?)*/
  3286. a
  3287. 0:
  3288. 1:
  3289. aaaa
  3290. 0:
  3291. 1:
  3292. /([ab]*?)*/
  3293. a
  3294. 0:
  3295. 1:
  3296. b
  3297. 0:
  3298. 1:
  3299. abab
  3300. 0:
  3301. 1:
  3302. baba
  3303. 0:
  3304. 1:
  3305. /([^a]*?)*/
  3306. b
  3307. 0:
  3308. 1:
  3309. bbbb
  3310. 0:
  3311. 1:
  3312. aaa
  3313. 0:
  3314. 1:
  3315. /([^ab]*?)*/
  3316. c
  3317. 0:
  3318. 1:
  3319. cccc
  3320. 0:
  3321. 1:
  3322. baba
  3323. 0:
  3324. 1:
  3325. /(?>a*)*/
  3326. a
  3327. 0: a
  3328. aaabcde
  3329. 0: aaa
  3330. /((?>a*))*/
  3331. aaaaa
  3332. 0: aaaaa
  3333. 1:
  3334. aabbaa
  3335. 0: aa
  3336. 1:
  3337. /((?>a*?))*/
  3338. aaaaa
  3339. 0:
  3340. 1:
  3341. aabbaa
  3342. 0:
  3343. 1:
  3344. /(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x
  3345. 12-sep-98
  3346. 0: 12-sep-98
  3347. 12-09-98
  3348. 0: 12-09-98
  3349. *** Failers
  3350. No match
  3351. sep-12-98
  3352. No match
  3353. /(?<=(foo))bar\1/
  3354. foobarfoo
  3355. 0: barfoo
  3356. 1: foo
  3357. foobarfootling
  3358. 0: barfoo
  3359. 1: foo
  3360. *** Failers
  3361. No match
  3362. foobar
  3363. No match
  3364. barfoo
  3365. No match
  3366. /(?i:saturday|sunday)/
  3367. saturday
  3368. 0: saturday
  3369. sunday
  3370. 0: sunday
  3371. Saturday
  3372. 0: Saturday
  3373. Sunday
  3374. 0: Sunday
  3375. SATURDAY
  3376. 0: SATURDAY
  3377. SUNDAY
  3378. 0: SUNDAY
  3379. SunDay
  3380. 0: SunDay
  3381. /(a(?i)bc|BB)x/
  3382. abcx
  3383. 0: abcx
  3384. 1: abc
  3385. aBCx
  3386. 0: aBCx
  3387. 1: aBC
  3388. bbx
  3389. 0: bbx
  3390. 1: bb
  3391. BBx
  3392. 0: BBx
  3393. 1: BB
  3394. *** Failers
  3395. No match
  3396. abcX
  3397. No match
  3398. aBCX
  3399. No match
  3400. bbX
  3401. No match
  3402. BBX
  3403. No match
  3404. /^([ab](?i)[cd]|[ef])/
  3405. ac
  3406. 0: ac
  3407. 1: ac
  3408. aC
  3409. 0: aC
  3410. 1: aC
  3411. bD
  3412. 0: bD
  3413. 1: bD
  3414. elephant
  3415. 0: e
  3416. 1: e
  3417. Europe
  3418. 0: E
  3419. 1: E
  3420. frog
  3421. 0: f
  3422. 1: f
  3423. France
  3424. 0: F
  3425. 1: F
  3426. *** Failers
  3427. No match
  3428. Africa
  3429. No match
  3430. /^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
  3431. ab
  3432. 0: ab
  3433. 1: ab
  3434. aBd
  3435. 0: aBd
  3436. 1: aBd
  3437. xy
  3438. 0: xy
  3439. 1: xy
  3440. xY
  3441. 0: xY
  3442. 1: xY
  3443. zebra
  3444. 0: z
  3445. 1: z
  3446. Zambesi
  3447. 0: Z
  3448. 1: Z
  3449. *** Failers
  3450. No match
  3451. aCD
  3452. No match
  3453. XY
  3454. No match
  3455. /(?<=foo\n)^bar/m
  3456. foo\nbar
  3457. 0: bar
  3458. *** Failers
  3459. No match
  3460. bar
  3461. No match
  3462. baz\nbar
  3463. No match
  3464. /(?<=(?<!foo)bar)baz/
  3465. barbaz
  3466. 0: baz
  3467. barbarbaz
  3468. 0: baz
  3469. koobarbaz
  3470. 0: baz
  3471. *** Failers
  3472. No match
  3473. baz
  3474. No match
  3475. foobarbaz
  3476. No match
  3477. /The cases of aaaa and aaaaaa are missed out below because Perl does things/
  3478. /differently. We know that odd, and maybe incorrect, things happen with/
  3479. No match
  3480. /recursive references in Perl, as far as 5.11.3 - see some stuff in test #2./
  3481. No match
  3482. /^(a\1?){4}$/
  3483. a
  3484. No match
  3485. aa
  3486. No match
  3487. aaa
  3488. No match
  3489. aaaaa
  3490. 0: aaaaa
  3491. 1: a
  3492. aaaaaaa
  3493. 0: aaaaaaa
  3494. 1: a
  3495. aaaaaaaa
  3496. No match
  3497. aaaaaaaaa
  3498. No match
  3499. aaaaaaaaaa
  3500. 0: aaaaaaaaaa
  3501. 1: aaaa
  3502. aaaaaaaaaaa
  3503. No match
  3504. aaaaaaaaaaaa
  3505. No match
  3506. aaaaaaaaaaaaa
  3507. No match
  3508. aaaaaaaaaaaaaa
  3509. No match
  3510. aaaaaaaaaaaaaaa
  3511. No match
  3512. aaaaaaaaaaaaaaaa
  3513. No match
  3514. /^(a\1?)(a\1?)(a\2?)(a\3?)$/
  3515. a
  3516. No match
  3517. aa
  3518. No match
  3519. aaa
  3520. No match
  3521. aaaa
  3522. 0: aaaa
  3523. 1: a
  3524. 2: a
  3525. 3: a
  3526. 4: a
  3527. aaaaa
  3528. 0: aaaaa
  3529. 1: a
  3530. 2: aa
  3531. 3: a
  3532. 4: a
  3533. aaaaaa
  3534. 0: aaaaaa
  3535. 1: a
  3536. 2: aa
  3537. 3: a
  3538. 4: aa
  3539. aaaaaaa
  3540. 0: aaaaaaa
  3541. 1: a
  3542. 2: aa
  3543. 3: aaa
  3544. 4: a
  3545. aaaaaaaa
  3546. No match
  3547. aaaaaaaaa
  3548. No match
  3549. aaaaaaaaaa
  3550. 0: aaaaaaaaaa
  3551. 1: a
  3552. 2: aa
  3553. 3: aaa
  3554. 4: aaaa
  3555. aaaaaaaaaaa
  3556. No match
  3557. aaaaaaaaaaaa
  3558. No match
  3559. aaaaaaaaaaaaa
  3560. No match
  3561. aaaaaaaaaaaaaa
  3562. No match
  3563. aaaaaaaaaaaaaaa
  3564. No match
  3565. aaaaaaaaaaaaaaaa
  3566. No match
  3567. /The following tests are taken from the Perl 5.005 test suite; some of them/
  3568. /are compatible with 5.004, but I'd rather not have to sort them out./
  3569. No match
  3570. /abc/
  3571. abc
  3572. 0: abc
  3573. xabcy
  3574. 0: abc
  3575. ababc
  3576. 0: abc
  3577. *** Failers
  3578. No match
  3579. xbc
  3580. No match
  3581. axc
  3582. No match
  3583. abx
  3584. No match
  3585. /ab*c/
  3586. abc
  3587. 0: abc
  3588. /ab*bc/
  3589. abc
  3590. 0: abc
  3591. abbc
  3592. 0: abbc
  3593. abbbbc
  3594. 0: abbbbc
  3595. /.{1}/
  3596. abbbbc
  3597. 0: a
  3598. /.{3,4}/
  3599. abbbbc
  3600. 0: abbb
  3601. /ab{0,}bc/
  3602. abbbbc
  3603. 0: abbbbc
  3604. /ab+bc/
  3605. abbc
  3606. 0: abbc
  3607. *** Failers
  3608. No match
  3609. abc
  3610. No match
  3611. abq
  3612. No match
  3613. /ab{1,}bc/
  3614. /ab+bc/
  3615. abbbbc
  3616. 0: abbbbc
  3617. /ab{1,}bc/
  3618. abbbbc
  3619. 0: abbbbc
  3620. /ab{1,3}bc/
  3621. abbbbc
  3622. 0: abbbbc
  3623. /ab{3,4}bc/
  3624. abbbbc
  3625. 0: abbbbc
  3626. /ab{4,5}bc/
  3627. *** Failers
  3628. No match
  3629. abq
  3630. No match
  3631. abbbbc
  3632. No match
  3633. /ab?bc/
  3634. abbc
  3635. 0: abbc
  3636. abc
  3637. 0: abc
  3638. /ab{0,1}bc/
  3639. abc
  3640. 0: abc
  3641. /ab?bc/
  3642. /ab?c/
  3643. abc
  3644. 0: abc
  3645. /ab{0,1}c/
  3646. abc
  3647. 0: abc
  3648. /^abc$/
  3649. abc
  3650. 0: abc
  3651. *** Failers
  3652. No match
  3653. abbbbc
  3654. No match
  3655. abcc
  3656. No match
  3657. /^abc/
  3658. abcc
  3659. 0: abc
  3660. /^abc$/
  3661. /abc$/
  3662. aabc
  3663. 0: abc
  3664. *** Failers
  3665. No match
  3666. aabc
  3667. 0: abc
  3668. aabcd
  3669. No match
  3670. /^/
  3671. abc
  3672. 0:
  3673. /$/
  3674. abc
  3675. 0:
  3676. /a.c/
  3677. abc
  3678. 0: abc
  3679. axc
  3680. 0: axc
  3681. /a.*c/
  3682. axyzc
  3683. 0: axyzc
  3684. /a[bc]d/
  3685. abd
  3686. 0: abd
  3687. *** Failers
  3688. No match
  3689. axyzd
  3690. No match
  3691. abc
  3692. No match
  3693. /a[b-d]e/
  3694. ace
  3695. 0: ace
  3696. /a[b-d]/
  3697. aac
  3698. 0: ac
  3699. /a[-b]/
  3700. a-
  3701. 0: a-
  3702. /a[b-]/
  3703. a-
  3704. 0: a-
  3705. /a]/
  3706. a]
  3707. 0: a]
  3708. /a[]]b/
  3709. a]b
  3710. 0: a]b
  3711. /a[^bc]d/
  3712. aed
  3713. 0: aed
  3714. *** Failers
  3715. No match
  3716. abd
  3717. No match
  3718. abd
  3719. No match
  3720. /a[^-b]c/
  3721. adc
  3722. 0: adc
  3723. /a[^]b]c/
  3724. adc
  3725. 0: adc
  3726. *** Failers
  3727. No match
  3728. a-c
  3729. 0: a-c
  3730. a]c
  3731. No match
  3732. /\ba\b/
  3733. a-
  3734. 0: a
  3735. -a
  3736. 0: a
  3737. -a-
  3738. 0: a
  3739. /\by\b/
  3740. *** Failers
  3741. No match
  3742. xy
  3743. No match
  3744. yz
  3745. No match
  3746. xyz
  3747. No match
  3748. /\Ba\B/
  3749. *** Failers
  3750. 0: a
  3751. a-
  3752. No match
  3753. -a
  3754. No match
  3755. -a-
  3756. No match
  3757. /\By\b/
  3758. xy
  3759. 0: y
  3760. /\by\B/
  3761. yz
  3762. 0: y
  3763. /\By\B/
  3764. xyz
  3765. 0: y
  3766. /\w/
  3767. a
  3768. 0: a
  3769. /\W/
  3770. -
  3771. 0: -
  3772. *** Failers
  3773. 0: *
  3774. -
  3775. 0: -
  3776. a
  3777. No match
  3778. /a\sb/
  3779. a b
  3780. 0: a b
  3781. /a\Sb/
  3782. a-b
  3783. 0: a-b
  3784. *** Failers
  3785. No match
  3786. a-b
  3787. 0: a-b
  3788. a b
  3789. No match
  3790. /\d/
  3791. 1
  3792. 0: 1
  3793. /\D/
  3794. -
  3795. 0: -
  3796. *** Failers
  3797. 0: *
  3798. -
  3799. 0: -
  3800. 1
  3801. No match
  3802. /[\w]/
  3803. a
  3804. 0: a
  3805. /[\W]/
  3806. -
  3807. 0: -
  3808. *** Failers
  3809. 0: *
  3810. -
  3811. 0: -
  3812. a
  3813. No match
  3814. /a[\s]b/
  3815. a b
  3816. 0: a b
  3817. /a[\S]b/
  3818. a-b
  3819. 0: a-b
  3820. *** Failers
  3821. No match
  3822. a-b
  3823. 0: a-b
  3824. a b
  3825. No match
  3826. /[\d]/
  3827. 1
  3828. 0: 1
  3829. /[\D]/
  3830. -
  3831. 0: -
  3832. *** Failers
  3833. 0: *
  3834. -
  3835. 0: -
  3836. 1
  3837. No match
  3838. /ab|cd/
  3839. abc
  3840. 0: ab
  3841. abcd
  3842. 0: ab
  3843. /()ef/
  3844. def
  3845. 0: ef
  3846. 1:
  3847. /$b/
  3848. /a\(b/
  3849. a(b
  3850. 0: a(b
  3851. /a\(*b/
  3852. ab
  3853. 0: ab
  3854. a((b
  3855. 0: a((b
  3856. /a\\b/
  3857. a\b
  3858. No match
  3859. /((a))/
  3860. abc
  3861. 0: a
  3862. 1: a
  3863. 2: a
  3864. /(a)b(c)/
  3865. abc
  3866. 0: abc
  3867. 1: a
  3868. 2: c
  3869. /a+b+c/
  3870. aabbabc
  3871. 0: abc
  3872. /a{1,}b{1,}c/
  3873. aabbabc
  3874. 0: abc
  3875. /a.+?c/
  3876. abcabc
  3877. 0: abc
  3878. /(a+|b)*/
  3879. ab
  3880. 0: ab
  3881. 1: b
  3882. /(a+|b){0,}/
  3883. ab
  3884. 0: ab
  3885. 1: b
  3886. /(a+|b)+/
  3887. ab
  3888. 0: ab
  3889. 1: b
  3890. /(a+|b){1,}/
  3891. ab
  3892. 0: ab
  3893. 1: b
  3894. /(a+|b)?/
  3895. ab
  3896. 0: a
  3897. 1: a
  3898. /(a+|b){0,1}/
  3899. ab
  3900. 0: a
  3901. 1: a
  3902. /[^ab]*/
  3903. cde
  3904. 0: cde
  3905. /abc/
  3906. *** Failers
  3907. No match
  3908. b
  3909. No match
  3910. /a*/
  3911. /([abc])*d/
  3912. abbbcd
  3913. 0: abbbcd
  3914. 1: c
  3915. /([abc])*bcd/
  3916. abcd
  3917. 0: abcd
  3918. 1: a
  3919. /a|b|c|d|e/
  3920. e
  3921. 0: e
  3922. /(a|b|c|d|e)f/
  3923. ef
  3924. 0: ef
  3925. 1: e
  3926. /abcd*efg/
  3927. abcdefg
  3928. 0: abcdefg
  3929. /ab*/
  3930. xabyabbbz
  3931. 0: ab
  3932. xayabbbz
  3933. 0: a
  3934. /(ab|cd)e/
  3935. abcde
  3936. 0: cde
  3937. 1: cd
  3938. /[abhgefdc]ij/
  3939. hij
  3940. 0: hij
  3941. /^(ab|cd)e/
  3942. /(abc|)ef/
  3943. abcdef
  3944. 0: ef
  3945. 1:
  3946. /(a|b)c*d/
  3947. abcd
  3948. 0: bcd
  3949. 1: b
  3950. /(ab|ab*)bc/
  3951. abc
  3952. 0: abc
  3953. 1: a
  3954. /a([bc]*)c*/
  3955. abc
  3956. 0: abc
  3957. 1: bc
  3958. /a([bc]*)(c*d)/
  3959. abcd
  3960. 0: abcd
  3961. 1: bc
  3962. 2: d
  3963. /a([bc]+)(c*d)/
  3964. abcd
  3965. 0: abcd
  3966. 1: bc
  3967. 2: d
  3968. /a([bc]*)(c+d)/
  3969. abcd
  3970. 0: abcd
  3971. 1: b
  3972. 2: cd
  3973. /a[bcd]*dcdcde/
  3974. adcdcde
  3975. 0: adcdcde
  3976. /a[bcd]+dcdcde/
  3977. *** Failers
  3978. No match
  3979. abcde
  3980. No match
  3981. adcdcde
  3982. No match
  3983. /(ab|a)b*c/
  3984. abc
  3985. 0: abc
  3986. 1: ab
  3987. /((a)(b)c)(d)/
  3988. abcd
  3989. 0: abcd
  3990. 1: abc
  3991. 2: a
  3992. 3: b
  3993. 4: d
  3994. /[a-zA-Z_][a-zA-Z0-9_]*/
  3995. alpha
  3996. 0: alpha
  3997. /^a(bc+|b[eh])g|.h$/
  3998. abh
  3999. 0: bh
  4000. /(bc+d$|ef*g.|h?i(j|k))/
  4001. effgz
  4002. 0: effgz
  4003. 1: effgz
  4004. ij
  4005. 0: ij
  4006. 1: ij
  4007. 2: j
  4008. reffgz
  4009. 0: effgz
  4010. 1: effgz
  4011. *** Failers
  4012. No match
  4013. effg
  4014. No match
  4015. bcdd
  4016. No match
  4017. /((((((((((a))))))))))/
  4018. a
  4019. 0: a
  4020. 1: a
  4021. 2: a
  4022. 3: a
  4023. 4: a
  4024. 5: a
  4025. 6: a
  4026. 7: a
  4027. 8: a
  4028. 9: a
  4029. 10: a
  4030. /((((((((((a))))))))))\10/
  4031. aa
  4032. 0: aa
  4033. 1: a
  4034. 2: a
  4035. 3: a
  4036. 4: a
  4037. 5: a
  4038. 6: a
  4039. 7: a
  4040. 8: a
  4041. 9: a
  4042. 10: a
  4043. /(((((((((a)))))))))/
  4044. a
  4045. 0: a
  4046. 1: a
  4047. 2: a
  4048. 3: a
  4049. 4: a
  4050. 5: a
  4051. 6: a
  4052. 7: a
  4053. 8: a
  4054. 9: a
  4055. /multiple words of text/
  4056. *** Failers
  4057. No match
  4058. aa
  4059. No match
  4060. uh-uh
  4061. No match
  4062. /multiple words/
  4063. multiple words, yeah
  4064. 0: multiple words
  4065. /(.*)c(.*)/
  4066. abcde
  4067. 0: abcde
  4068. 1: ab
  4069. 2: de
  4070. /\((.*), (.*)\)/
  4071. (a, b)
  4072. 0: (a, b)
  4073. 1: a
  4074. 2: b
  4075. /[k]/
  4076. /abcd/
  4077. abcd
  4078. 0: abcd
  4079. /a(bc)d/
  4080. abcd
  4081. 0: abcd
  4082. 1: bc
  4083. /a[-]?c/
  4084. ac
  4085. 0: ac
  4086. /(abc)\1/
  4087. abcabc
  4088. 0: abcabc
  4089. 1: abc
  4090. /([a-c]*)\1/
  4091. abcabc
  4092. 0: abcabc
  4093. 1: abc
  4094. /(a)|\1/
  4095. a
  4096. 0: a
  4097. 1: a
  4098. *** Failers
  4099. 0: a
  4100. 1: a
  4101. ab
  4102. 0: a
  4103. 1: a
  4104. x
  4105. No match
  4106. /(([a-c])b*?\2)*/
  4107. ababbbcbc
  4108. 0: ababb
  4109. 1: bb
  4110. 2: b
  4111. /(([a-c])b*?\2){3}/
  4112. ababbbcbc
  4113. 0: ababbbcbc
  4114. 1: cbc
  4115. 2: c
  4116. /((\3|b)\2(a)x)+/
  4117. aaaxabaxbaaxbbax
  4118. 0: bbax
  4119. 1: bbax
  4120. 2: b
  4121. 3: a
  4122. /((\3|b)\2(a)){2,}/
  4123. bbaababbabaaaaabbaaaabba
  4124. 0: bbaaaabba
  4125. 1: bba
  4126. 2: b
  4127. 3: a
  4128. /abc/i
  4129. ABC
  4130. 0: ABC
  4131. XABCY
  4132. 0: ABC
  4133. ABABC
  4134. 0: ABC
  4135. *** Failers
  4136. No match
  4137. aaxabxbaxbbx
  4138. No match
  4139. XBC
  4140. No match
  4141. AXC
  4142. No match
  4143. ABX
  4144. No match
  4145. /ab*c/i
  4146. ABC
  4147. 0: ABC
  4148. /ab*bc/i
  4149. ABC
  4150. 0: ABC
  4151. ABBC
  4152. 0: ABBC
  4153. /ab*?bc/i
  4154. ABBBBC
  4155. 0: ABBBBC
  4156. /ab{0,}?bc/i
  4157. ABBBBC
  4158. 0: ABBBBC
  4159. /ab+?bc/i
  4160. ABBC
  4161. 0: ABBC
  4162. /ab+bc/i
  4163. *** Failers
  4164. No match
  4165. ABC
  4166. No match
  4167. ABQ
  4168. No match
  4169. /ab{1,}bc/i
  4170. /ab+bc/i
  4171. ABBBBC
  4172. 0: ABBBBC
  4173. /ab{1,}?bc/i
  4174. ABBBBC
  4175. 0: ABBBBC
  4176. /ab{1,3}?bc/i
  4177. ABBBBC
  4178. 0: ABBBBC
  4179. /ab{3,4}?bc/i
  4180. ABBBBC
  4181. 0: ABBBBC
  4182. /ab{4,5}?bc/i
  4183. *** Failers
  4184. No match
  4185. ABQ
  4186. No match
  4187. ABBBBC
  4188. No match
  4189. /ab??bc/i
  4190. ABBC
  4191. 0: ABBC
  4192. ABC
  4193. 0: ABC
  4194. /ab{0,1}?bc/i
  4195. ABC
  4196. 0: ABC
  4197. /ab??bc/i
  4198. /ab??c/i
  4199. ABC
  4200. 0: ABC
  4201. /ab{0,1}?c/i
  4202. ABC
  4203. 0: ABC
  4204. /^abc$/i
  4205. ABC
  4206. 0: ABC
  4207. *** Failers
  4208. No match
  4209. ABBBBC
  4210. No match
  4211. ABCC
  4212. No match
  4213. /^abc/i
  4214. ABCC
  4215. 0: ABC
  4216. /^abc$/i
  4217. /abc$/i
  4218. AABC
  4219. 0: ABC
  4220. /^/i
  4221. ABC
  4222. 0:
  4223. /$/i
  4224. ABC
  4225. 0:
  4226. /a.c/i
  4227. ABC
  4228. 0: ABC
  4229. AXC
  4230. 0: AXC
  4231. /a.*?c/i
  4232. AXYZC
  4233. 0: AXYZC
  4234. /a.*c/i
  4235. *** Failers
  4236. No match
  4237. AABC
  4238. 0: AABC
  4239. AXYZD
  4240. No match
  4241. /a[bc]d/i
  4242. ABD
  4243. 0: ABD
  4244. /a[b-d]e/i
  4245. ACE
  4246. 0: ACE
  4247. *** Failers
  4248. No match
  4249. ABC
  4250. No match
  4251. ABD
  4252. No match
  4253. /a[b-d]/i
  4254. AAC
  4255. 0: AC
  4256. /a[-b]/i
  4257. A-
  4258. 0: A-
  4259. /a[b-]/i
  4260. A-
  4261. 0: A-
  4262. /a]/i
  4263. A]
  4264. 0: A]
  4265. /a[]]b/i
  4266. A]B
  4267. 0: A]B
  4268. /a[^bc]d/i
  4269. AED
  4270. 0: AED
  4271. /a[^-b]c/i
  4272. ADC
  4273. 0: ADC
  4274. *** Failers
  4275. No match
  4276. ABD
  4277. No match
  4278. A-C
  4279. No match
  4280. /a[^]b]c/i
  4281. ADC
  4282. 0: ADC
  4283. /ab|cd/i
  4284. ABC
  4285. 0: AB
  4286. ABCD
  4287. 0: AB
  4288. /()ef/i
  4289. DEF
  4290. 0: EF
  4291. 1:
  4292. /$b/i
  4293. *** Failers
  4294. No match
  4295. A]C
  4296. No match
  4297. B
  4298. No match
  4299. /a\(b/i
  4300. A(B
  4301. 0: A(B
  4302. /a\(*b/i
  4303. AB
  4304. 0: AB
  4305. A((B
  4306. 0: A((B
  4307. /a\\b/i
  4308. A\B
  4309. No match
  4310. /((a))/i
  4311. ABC
  4312. 0: A
  4313. 1: A
  4314. 2: A
  4315. /(a)b(c)/i
  4316. ABC
  4317. 0: ABC
  4318. 1: A
  4319. 2: C
  4320. /a+b+c/i
  4321. AABBABC
  4322. 0: ABC
  4323. /a{1,}b{1,}c/i
  4324. AABBABC
  4325. 0: ABC
  4326. /a.+?c/i
  4327. ABCABC
  4328. 0: ABC
  4329. /a.*?c/i
  4330. ABCABC
  4331. 0: ABC
  4332. /a.{0,5}?c/i
  4333. ABCABC
  4334. 0: ABC
  4335. /(a+|b)*/i
  4336. AB
  4337. 0: AB
  4338. 1: B
  4339. /(a+|b){0,}/i
  4340. AB
  4341. 0: AB
  4342. 1: B
  4343. /(a+|b)+/i
  4344. AB
  4345. 0: AB
  4346. 1: B
  4347. /(a+|b){1,}/i
  4348. AB
  4349. 0: AB
  4350. 1: B
  4351. /(a+|b)?/i
  4352. AB
  4353. 0: A
  4354. 1: A
  4355. /(a+|b){0,1}/i
  4356. AB
  4357. 0: A
  4358. 1: A
  4359. /(a+|b){0,1}?/i
  4360. AB
  4361. 0:
  4362. /[^ab]*/i
  4363. CDE
  4364. 0: CDE
  4365. /abc/i
  4366. /a*/i
  4367. /([abc])*d/i
  4368. ABBBCD
  4369. 0: ABBBCD
  4370. 1: C
  4371. /([abc])*bcd/i
  4372. ABCD
  4373. 0: ABCD
  4374. 1: A
  4375. /a|b|c|d|e/i
  4376. E
  4377. 0: E
  4378. /(a|b|c|d|e)f/i
  4379. EF
  4380. 0: EF
  4381. 1: E
  4382. /abcd*efg/i
  4383. ABCDEFG
  4384. 0: ABCDEFG
  4385. /ab*/i
  4386. XABYABBBZ
  4387. 0: AB
  4388. XAYABBBZ
  4389. 0: A
  4390. /(ab|cd)e/i
  4391. ABCDE
  4392. 0: CDE
  4393. 1: CD
  4394. /[abhgefdc]ij/i
  4395. HIJ
  4396. 0: HIJ
  4397. /^(ab|cd)e/i
  4398. ABCDE
  4399. No match
  4400. /(abc|)ef/i
  4401. ABCDEF
  4402. 0: EF
  4403. 1:
  4404. /(a|b)c*d/i
  4405. ABCD
  4406. 0: BCD
  4407. 1: B
  4408. /(ab|ab*)bc/i
  4409. ABC
  4410. 0: ABC
  4411. 1: A
  4412. /a([bc]*)c*/i
  4413. ABC
  4414. 0: ABC
  4415. 1: BC
  4416. /a([bc]*)(c*d)/i
  4417. ABCD
  4418. 0: ABCD
  4419. 1: BC
  4420. 2: D
  4421. /a([bc]+)(c*d)/i
  4422. ABCD
  4423. 0: ABCD
  4424. 1: BC
  4425. 2: D
  4426. /a([bc]*)(c+d)/i
  4427. ABCD
  4428. 0: ABCD
  4429. 1: B
  4430. 2: CD
  4431. /a[bcd]*dcdcde/i
  4432. ADCDCDE
  4433. 0: ADCDCDE
  4434. /a[bcd]+dcdcde/i
  4435. /(ab|a)b*c/i
  4436. ABC
  4437. 0: ABC
  4438. 1: AB
  4439. /((a)(b)c)(d)/i
  4440. ABCD
  4441. 0: ABCD
  4442. 1: ABC
  4443. 2: A
  4444. 3: B
  4445. 4: D
  4446. /[a-zA-Z_][a-zA-Z0-9_]*/i
  4447. ALPHA
  4448. 0: ALPHA
  4449. /^a(bc+|b[eh])g|.h$/i
  4450. ABH
  4451. 0: BH
  4452. /(bc+d$|ef*g.|h?i(j|k))/i
  4453. EFFGZ
  4454. 0: EFFGZ
  4455. 1: EFFGZ
  4456. IJ
  4457. 0: IJ
  4458. 1: IJ
  4459. 2: J
  4460. REFFGZ
  4461. 0: EFFGZ
  4462. 1: EFFGZ
  4463. *** Failers
  4464. No match
  4465. ADCDCDE
  4466. No match
  4467. EFFG
  4468. No match
  4469. BCDD
  4470. No match
  4471. /((((((((((a))))))))))/i
  4472. A
  4473. 0: A
  4474. 1: A
  4475. 2: A
  4476. 3: A
  4477. 4: A
  4478. 5: A
  4479. 6: A
  4480. 7: A
  4481. 8: A
  4482. 9: A
  4483. 10: A
  4484. /((((((((((a))))))))))\10/i
  4485. AA
  4486. 0: AA
  4487. 1: A
  4488. 2: A
  4489. 3: A
  4490. 4: A
  4491. 5: A
  4492. 6: A
  4493. 7: A
  4494. 8: A
  4495. 9: A
  4496. 10: A
  4497. /(((((((((a)))))))))/i
  4498. A
  4499. 0: A
  4500. 1: A
  4501. 2: A
  4502. 3: A
  4503. 4: A
  4504. 5: A
  4505. 6: A
  4506. 7: A
  4507. 8: A
  4508. 9: A
  4509. /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
  4510. A
  4511. 0: A
  4512. 1: A
  4513. /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
  4514. C
  4515. 0: C
  4516. 1: C
  4517. /multiple words of text/i
  4518. *** Failers
  4519. No match
  4520. AA
  4521. No match
  4522. UH-UH
  4523. No match
  4524. /multiple words/i
  4525. MULTIPLE WORDS, YEAH
  4526. 0: MULTIPLE WORDS
  4527. /(.*)c(.*)/i
  4528. ABCDE
  4529. 0: ABCDE
  4530. 1: AB
  4531. 2: DE
  4532. /\((.*), (.*)\)/i
  4533. (A, B)
  4534. 0: (A, B)
  4535. 1: A
  4536. 2: B
  4537. /[k]/i
  4538. /abcd/i
  4539. ABCD
  4540. 0: ABCD
  4541. /a(bc)d/i
  4542. ABCD
  4543. 0: ABCD
  4544. 1: BC
  4545. /a[-]?c/i
  4546. AC
  4547. 0: AC
  4548. /(abc)\1/i
  4549. ABCABC
  4550. 0: ABCABC
  4551. 1: ABC
  4552. /([a-c]*)\1/i
  4553. ABCABC
  4554. 0: ABCABC
  4555. 1: ABC
  4556. /a(?!b)./
  4557. abad
  4558. 0: ad
  4559. /a(?=d)./
  4560. abad
  4561. 0: ad
  4562. /a(?=c|d)./
  4563. abad
  4564. 0: ad
  4565. /a(?:b|c|d)(.)/
  4566. ace
  4567. 0: ace
  4568. 1: e
  4569. /a(?:b|c|d)*(.)/
  4570. ace
  4571. 0: ace
  4572. 1: e
  4573. /a(?:b|c|d)+?(.)/
  4574. ace
  4575. 0: ace
  4576. 1: e
  4577. acdbcdbe
  4578. 0: acd
  4579. 1: d
  4580. /a(?:b|c|d)+(.)/
  4581. acdbcdbe
  4582. 0: acdbcdbe
  4583. 1: e
  4584. /a(?:b|c|d){2}(.)/
  4585. acdbcdbe
  4586. 0: acdb
  4587. 1: b
  4588. /a(?:b|c|d){4,5}(.)/
  4589. acdbcdbe
  4590. 0: acdbcdb
  4591. 1: b
  4592. /a(?:b|c|d){4,5}?(.)/
  4593. acdbcdbe
  4594. 0: acdbcd
  4595. 1: d
  4596. /((foo)|(bar))*/
  4597. foobar
  4598. 0: foobar
  4599. 1: bar
  4600. 2: foo
  4601. 3: bar
  4602. /a(?:b|c|d){6,7}(.)/
  4603. acdbcdbe
  4604. 0: acdbcdbe
  4605. 1: e
  4606. /a(?:b|c|d){6,7}?(.)/
  4607. acdbcdbe
  4608. 0: acdbcdbe
  4609. 1: e
  4610. /a(?:b|c|d){5,6}(.)/
  4611. acdbcdbe
  4612. 0: acdbcdbe
  4613. 1: e
  4614. /a(?:b|c|d){5,6}?(.)/
  4615. acdbcdbe
  4616. 0: acdbcdb
  4617. 1: b
  4618. /a(?:b|c|d){5,7}(.)/
  4619. acdbcdbe
  4620. 0: acdbcdbe
  4621. 1: e
  4622. /a(?:b|c|d){5,7}?(.)/
  4623. acdbcdbe
  4624. 0: acdbcdb
  4625. 1: b
  4626. /a(?:b|(c|e){1,2}?|d)+?(.)/
  4627. ace
  4628. 0: ace
  4629. 1: c
  4630. 2: e
  4631. /^(.+)?B/
  4632. AB
  4633. 0: AB
  4634. 1: A
  4635. /^([^a-z])|(\^)$/
  4636. .
  4637. 0: .
  4638. 1: .
  4639. /^[<>]&/
  4640. <&OUT
  4641. 0: <&
  4642. /^(a\1?){4}$/
  4643. aaaaaaaaaa
  4644. 0: aaaaaaaaaa
  4645. 1: aaaa
  4646. *** Failers
  4647. No match
  4648. AB
  4649. No match
  4650. aaaaaaaaa
  4651. No match
  4652. aaaaaaaaaaa
  4653. No match
  4654. /^(a(?(1)\1)){4}$/
  4655. aaaaaaaaaa
  4656. 0: aaaaaaaaaa
  4657. 1: aaaa
  4658. *** Failers
  4659. No match
  4660. aaaaaaaaa
  4661. No match
  4662. aaaaaaaaaaa
  4663. No match
  4664. /(?:(f)(o)(o)|(b)(a)(r))*/
  4665. foobar
  4666. 0: foobar
  4667. 1: f
  4668. 2: o
  4669. 3: o
  4670. 4: b
  4671. 5: a
  4672. 6: r
  4673. /(?<=a)b/
  4674. ab
  4675. 0: b
  4676. *** Failers
  4677. No match
  4678. cb
  4679. No match
  4680. b
  4681. No match
  4682. /(?<!c)b/
  4683. ab
  4684. 0: b
  4685. b
  4686. 0: b
  4687. b
  4688. 0: b
  4689. /(?:..)*a/
  4690. aba
  4691. 0: aba
  4692. /(?:..)*?a/
  4693. aba
  4694. 0: a
  4695. /^(?:b|a(?=(.)))*\1/
  4696. abc
  4697. 0: ab
  4698. 1: b
  4699. /^(){3,5}/
  4700. abc
  4701. 0:
  4702. 1:
  4703. /^(a+)*ax/
  4704. aax
  4705. 0: aax
  4706. 1: a
  4707. /^((a|b)+)*ax/
  4708. aax
  4709. 0: aax
  4710. 1: a
  4711. 2: a
  4712. /^((a|bc)+)*ax/
  4713. aax
  4714. 0: aax
  4715. 1: a
  4716. 2: a
  4717. /(a|x)*ab/
  4718. cab
  4719. 0: ab
  4720. /(a)*ab/
  4721. cab
  4722. 0: ab
  4723. /(?:(?i)a)b/
  4724. ab
  4725. 0: ab
  4726. /((?i)a)b/
  4727. ab
  4728. 0: ab
  4729. 1: a
  4730. /(?:(?i)a)b/
  4731. Ab
  4732. 0: Ab
  4733. /((?i)a)b/
  4734. Ab
  4735. 0: Ab
  4736. 1: A
  4737. /(?:(?i)a)b/
  4738. *** Failers
  4739. No match
  4740. cb
  4741. No match
  4742. aB
  4743. No match
  4744. /((?i)a)b/
  4745. /(?i:a)b/
  4746. ab
  4747. 0: ab
  4748. /((?i:a))b/
  4749. ab
  4750. 0: ab
  4751. 1: a
  4752. /(?i:a)b/
  4753. Ab
  4754. 0: Ab
  4755. /((?i:a))b/
  4756. Ab
  4757. 0: Ab
  4758. 1: A
  4759. /(?i:a)b/
  4760. *** Failers
  4761. No match
  4762. aB
  4763. No match
  4764. aB
  4765. No match
  4766. /((?i:a))b/
  4767. /(?:(?-i)a)b/i
  4768. ab
  4769. 0: ab
  4770. /((?-i)a)b/i
  4771. ab
  4772. 0: ab
  4773. 1: a
  4774. /(?:(?-i)a)b/i
  4775. aB
  4776. 0: aB
  4777. /((?-i)a)b/i
  4778. aB
  4779. 0: aB
  4780. 1: a
  4781. /(?:(?-i)a)b/i
  4782. *** Failers
  4783. No match
  4784. aB
  4785. 0: aB
  4786. Ab
  4787. No match
  4788. /((?-i)a)b/i
  4789. /(?:(?-i)a)b/i
  4790. aB
  4791. 0: aB
  4792. /((?-i)a)b/i
  4793. aB
  4794. 0: aB
  4795. 1: a
  4796. /(?:(?-i)a)b/i
  4797. *** Failers
  4798. No match
  4799. Ab
  4800. No match
  4801. AB
  4802. No match
  4803. /((?-i)a)b/i
  4804. /(?-i:a)b/i
  4805. ab
  4806. 0: ab
  4807. /((?-i:a))b/i
  4808. ab
  4809. 0: ab
  4810. 1: a
  4811. /(?-i:a)b/i
  4812. aB
  4813. 0: aB
  4814. /((?-i:a))b/i
  4815. aB
  4816. 0: aB
  4817. 1: a
  4818. /(?-i:a)b/i
  4819. *** Failers
  4820. No match
  4821. AB
  4822. No match
  4823. Ab
  4824. No match
  4825. /((?-i:a))b/i
  4826. /(?-i:a)b/i
  4827. aB
  4828. 0: aB
  4829. /((?-i:a))b/i
  4830. aB
  4831. 0: aB
  4832. 1: a
  4833. /(?-i:a)b/i
  4834. *** Failers
  4835. No match
  4836. Ab
  4837. No match
  4838. AB
  4839. No match
  4840. /((?-i:a))b/i
  4841. /((?-i:a.))b/i
  4842. *** Failers
  4843. No match
  4844. AB
  4845. No match
  4846. a\nB
  4847. No match
  4848. /((?s-i:a.))b/i
  4849. a\nB
  4850. 0: a\x0aB
  4851. 1: a\x0a
  4852. /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
  4853. cabbbb
  4854. 0: cabbbb
  4855. /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
  4856. caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
  4857. 0: caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
  4858. /(ab)\d\1/i
  4859. Ab4ab
  4860. 0: Ab4ab
  4861. 1: Ab
  4862. ab4Ab
  4863. 0: ab4Ab
  4864. 1: ab
  4865. /foo\w*\d{4}baz/
  4866. foobar1234baz
  4867. 0: foobar1234baz
  4868. /x(~~)*(?:(?:F)?)?/
  4869. x~~
  4870. 0: x~~
  4871. 1: ~~
  4872. /^a(?#xxx){3}c/
  4873. aaac
  4874. 0: aaac
  4875. /^a (?#xxx) (?#yyy) {3}c/x
  4876. aaac
  4877. 0: aaac
  4878. /(?<![cd])b/
  4879. *** Failers
  4880. No match
  4881. B\nB
  4882. No match
  4883. dbcb
  4884. No match
  4885. /(?<![cd])[ab]/
  4886. dbaacb
  4887. 0: a
  4888. /(?<!(c|d))b/
  4889. /(?<!(c|d))[ab]/
  4890. dbaacb
  4891. 0: a
  4892. /(?<!cd)[ab]/
  4893. cdaccb
  4894. 0: b
  4895. /^(?:a?b?)*$/
  4896. \
  4897. 0:
  4898. a
  4899. 0: a
  4900. ab
  4901. 0: ab
  4902. aaa
  4903. 0: aaa
  4904. *** Failers
  4905. No match
  4906. dbcb
  4907. No match
  4908. a--
  4909. No match
  4910. aa--
  4911. No match
  4912. /((?s)^a(.))((?m)^b$)/
  4913. a\nb\nc\n
  4914. 0: a\x0ab
  4915. 1: a\x0a
  4916. 2: \x0a
  4917. 3: b
  4918. /((?m)^b$)/
  4919. a\nb\nc\n
  4920. 0: b
  4921. 1: b
  4922. /(?m)^b/
  4923. a\nb\n
  4924. 0: b
  4925. /(?m)^(b)/
  4926. a\nb\n
  4927. 0: b
  4928. 1: b
  4929. /((?m)^b)/
  4930. a\nb\n
  4931. 0: b
  4932. 1: b
  4933. /\n((?m)^b)/
  4934. a\nb\n
  4935. 0: \x0ab
  4936. 1: b
  4937. /((?s).)c(?!.)/
  4938. a\nb\nc\n
  4939. 0: \x0ac
  4940. 1: \x0a
  4941. a\nb\nc\n
  4942. 0: \x0ac
  4943. 1: \x0a
  4944. /((?s)b.)c(?!.)/
  4945. a\nb\nc\n
  4946. 0: b\x0ac
  4947. 1: b\x0a
  4948. a\nb\nc\n
  4949. 0: b\x0ac
  4950. 1: b\x0a
  4951. /^b/
  4952. /()^b/
  4953. *** Failers
  4954. No match
  4955. a\nb\nc\n
  4956. No match
  4957. a\nb\nc\n
  4958. No match
  4959. /((?m)^b)/
  4960. a\nb\nc\n
  4961. 0: b
  4962. 1: b
  4963. /(x)?(?(1)a|b)/
  4964. *** Failers
  4965. No match
  4966. a
  4967. No match
  4968. a
  4969. No match
  4970. /(x)?(?(1)b|a)/
  4971. a
  4972. 0: a
  4973. /()?(?(1)b|a)/
  4974. a
  4975. 0: a
  4976. /()(?(1)b|a)/
  4977. /()?(?(1)a|b)/
  4978. a
  4979. 0: a
  4980. 1:
  4981. /^(\()?blah(?(1)(\)))$/
  4982. (blah)
  4983. 0: (blah)
  4984. 1: (
  4985. 2: )
  4986. blah
  4987. 0: blah
  4988. *** Failers
  4989. No match
  4990. a
  4991. No match
  4992. blah)
  4993. No match
  4994. (blah
  4995. No match
  4996. /^(\(+)?blah(?(1)(\)))$/
  4997. (blah)
  4998. 0: (blah)
  4999. 1: (
  5000. 2: )
  5001. blah
  5002. 0: blah
  5003. *** Failers
  5004. No match
  5005. blah)
  5006. No match
  5007. (blah
  5008. No match
  5009. /(?(?!a)a|b)/
  5010. /(?(?!a)b|a)/
  5011. a
  5012. 0: a
  5013. /(?(?=a)b|a)/
  5014. *** Failers
  5015. No match
  5016. a
  5017. No match
  5018. a
  5019. No match
  5020. /(?(?=a)a|b)/
  5021. a
  5022. 0: a
  5023. /(?=(a+?))(\1ab)/
  5024. aaab
  5025. 0: aab
  5026. 1: a
  5027. 2: aab
  5028. /^(?=(a+?))\1ab/
  5029. /(\w+:)+/
  5030. one:
  5031. 0: one:
  5032. 1: one:
  5033. /$(?<=^(a))/
  5034. a
  5035. 0:
  5036. 1: a
  5037. /(?=(a+?))(\1ab)/
  5038. aaab
  5039. 0: aab
  5040. 1: a
  5041. 2: aab
  5042. /^(?=(a+?))\1ab/
  5043. *** Failers
  5044. No match
  5045. aaab
  5046. No match
  5047. aaab
  5048. No match
  5049. /([\w:]+::)?(\w+)$/
  5050. abcd
  5051. 0: abcd
  5052. 1: <unset>
  5053. 2: abcd
  5054. xy:z:::abcd
  5055. 0: xy:z:::abcd
  5056. 1: xy:z:::
  5057. 2: abcd
  5058. /^[^bcd]*(c+)/
  5059. aexycd
  5060. 0: aexyc
  5061. 1: c
  5062. /(a*)b+/
  5063. caab
  5064. 0: aab
  5065. 1: aa
  5066. /([\w:]+::)?(\w+)$/
  5067. abcd
  5068. 0: abcd
  5069. 1: <unset>
  5070. 2: abcd
  5071. xy:z:::abcd
  5072. 0: xy:z:::abcd
  5073. 1: xy:z:::
  5074. 2: abcd
  5075. *** Failers
  5076. 0: Failers
  5077. 1: <unset>
  5078. 2: Failers
  5079. abcd:
  5080. No match
  5081. abcd:
  5082. No match
  5083. /^[^bcd]*(c+)/
  5084. aexycd
  5085. 0: aexyc
  5086. 1: c
  5087. /(>a+)ab/
  5088. /(?>a+)b/
  5089. aaab
  5090. 0: aaab
  5091. /([[:]+)/
  5092. a:[b]:
  5093. 0: :[
  5094. 1: :[
  5095. /([[=]+)/
  5096. a=[b]=
  5097. 0: =[
  5098. 1: =[
  5099. /([[.]+)/
  5100. a.[b].
  5101. 0: .[
  5102. 1: .[
  5103. /((?>a+)b)/
  5104. aaab
  5105. 0: aaab
  5106. 1: aaab
  5107. /(?>(a+))b/
  5108. aaab
  5109. 0: aaab
  5110. 1: aaa
  5111. /((?>[^()]+)|\([^()]*\))+/
  5112. ((abc(ade)ufh()()x
  5113. 0: abc(ade)ufh()()x
  5114. 1: x
  5115. /a\Z/
  5116. *** Failers
  5117. No match
  5118. aaab
  5119. No match
  5120. a\nb\n
  5121. No match
  5122. /b\Z/
  5123. a\nb\n
  5124. 0: b
  5125. /b\z/
  5126. /b\Z/
  5127. a\nb
  5128. 0: b
  5129. /b\z/
  5130. a\nb
  5131. 0: b
  5132. *** Failers
  5133. No match
  5134. /^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/
  5135. a
  5136. 0: a
  5137. 1:
  5138. abc
  5139. 0: abc
  5140. 1:
  5141. a-b
  5142. 0: a-b
  5143. 1:
  5144. 0-9
  5145. 0: 0-9
  5146. 1:
  5147. a.b
  5148. 0: a.b
  5149. 1:
  5150. 5.6.7
  5151. 0: 5.6.7
  5152. 1:
  5153. the.quick.brown.fox
  5154. 0: the.quick.brown.fox
  5155. 1:
  5156. a100.b200.300c
  5157. 0: a100.b200.300c
  5158. 1:
  5159. 12-ab.1245
  5160. 0: 12-ab.1245
  5161. 1:
  5162. *** Failers
  5163. No match
  5164. \
  5165. No match
  5166. .a
  5167. No match
  5168. -a
  5169. No match
  5170. a-
  5171. No match
  5172. a.
  5173. No match
  5174. a_b
  5175. No match
  5176. a.-
  5177. No match
  5178. a..
  5179. No match
  5180. ab..bc
  5181. No match
  5182. the.quick.brown.fox-
  5183. No match
  5184. the.quick.brown.fox.
  5185. No match
  5186. the.quick.brown.fox_
  5187. No match
  5188. the.quick.brown.fox+
  5189. No match
  5190. /(?>.*)(?<=(abcd|wxyz))/
  5191. alphabetabcd
  5192. 0: alphabetabcd
  5193. 1: abcd
  5194. endingwxyz
  5195. 0: endingwxyz
  5196. 1: wxyz
  5197. *** Failers
  5198. No match
  5199. a rather long string that doesn't end with one of them
  5200. No match
  5201. /word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
  5202. word cat dog elephant mussel cow horse canary baboon snake shark otherword
  5203. 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
  5204. word cat dog elephant mussel cow horse canary baboon snake shark
  5205. No match
  5206. /word (?>[a-zA-Z0-9]+ ){0,30}otherword/
  5207. word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
  5208. No match
  5209. /(?<=\d{3}(?!999))foo/
  5210. 999foo
  5211. 0: foo
  5212. 123999foo
  5213. 0: foo
  5214. *** Failers
  5215. No match
  5216. 123abcfoo
  5217. No match
  5218. /(?<=(?!...999)\d{3})foo/
  5219. 999foo
  5220. 0: foo
  5221. 123999foo
  5222. 0: foo
  5223. *** Failers
  5224. No match
  5225. 123abcfoo
  5226. No match
  5227. /(?<=\d{3}(?!999)...)foo/
  5228. 123abcfoo
  5229. 0: foo
  5230. 123456foo
  5231. 0: foo
  5232. *** Failers
  5233. No match
  5234. 123999foo
  5235. No match
  5236. /(?<=\d{3}...)(?<!999)foo/
  5237. 123abcfoo
  5238. 0: foo
  5239. 123456foo
  5240. 0: foo
  5241. *** Failers
  5242. No match
  5243. 123999foo
  5244. No match
  5245. /<a[\s]+href[\s]*=[\s]* # find <a href=
  5246. ([\"\'])? # find single or double quote
  5247. (?(1) (.*?)\1 | ([^\s]+)) # if quote found, match up to next matching
  5248. # quote, otherwise match up to next space
  5249. /isx
  5250. <a href=abcd xyz
  5251. 0: <a href=abcd
  5252. 1: <unset>
  5253. 2: <unset>
  5254. 3: abcd
  5255. <a href=\"abcd xyz pqr\" cats
  5256. 0: <a href="abcd xyz pqr"
  5257. 1: "
  5258. 2: abcd xyz pqr
  5259. <a href=\'abcd xyz pqr\' cats
  5260. 0: <a href='abcd xyz pqr'
  5261. 1: '
  5262. 2: abcd xyz pqr
  5263. /<a\s+href\s*=\s* # find <a href=
  5264. (["'])? # find single or double quote
  5265. (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
  5266. # quote, otherwise match up to next space
  5267. /isx
  5268. <a href=abcd xyz
  5269. 0: <a href=abcd
  5270. 1: <unset>
  5271. 2: <unset>
  5272. 3: abcd
  5273. <a href=\"abcd xyz pqr\" cats
  5274. 0: <a href="abcd xyz pqr"
  5275. 1: "
  5276. 2: abcd xyz pqr
  5277. <a href = \'abcd xyz pqr\' cats
  5278. 0: <a href = 'abcd xyz pqr'
  5279. 1: '
  5280. 2: abcd xyz pqr
  5281. /<a\s+href(?>\s*)=(?>\s*) # find <a href=
  5282. (["'])? # find single or double quote
  5283. (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
  5284. # quote, otherwise match up to next space
  5285. /isx
  5286. <a href=abcd xyz
  5287. 0: <a href=abcd
  5288. 1: <unset>
  5289. 2: <unset>
  5290. 3: abcd
  5291. <a href=\"abcd xyz pqr\" cats
  5292. 0: <a href="abcd xyz pqr"
  5293. 1: "
  5294. 2: abcd xyz pqr
  5295. <a href = \'abcd xyz pqr\' cats
  5296. 0: <a href = 'abcd xyz pqr'
  5297. 1: '
  5298. 2: abcd xyz pqr
  5299. /((Z)+|A)*/
  5300. ZABCDEFG
  5301. 0: ZA
  5302. 1: A
  5303. 2: Z
  5304. /(Z()|A)*/
  5305. ZABCDEFG
  5306. 0: ZA
  5307. 1: A
  5308. 2:
  5309. /(Z(())|A)*/
  5310. ZABCDEFG
  5311. 0: ZA
  5312. 1: A
  5313. 2:
  5314. 3:
  5315. /((?>Z)+|A)*/
  5316. ZABCDEFG
  5317. 0: ZA
  5318. 1: A
  5319. /((?>)+|A)*/
  5320. ZABCDEFG
  5321. 0:
  5322. 1:
  5323. /a*/g
  5324. abbab
  5325. 0: a
  5326. 0:
  5327. 0:
  5328. 0: a
  5329. 0:
  5330. 0:
  5331. /^[\d-a]/
  5332. abcde
  5333. 0: a
  5334. -things
  5335. 0: -
  5336. 0digit
  5337. 0: 0
  5338. *** Failers
  5339. No match
  5340. bcdef
  5341. No match
  5342. /[[:space:]]+/
  5343. > \x09\x0a\x0c\x0d\x0b<
  5344. 0: \x09\x0a\x0c\x0d\x0b
  5345. /[[:blank:]]+/
  5346. > \x09\x0a\x0c\x0d\x0b<
  5347. 0: \x09
  5348. /[\s]+/
  5349. > \x09\x0a\x0c\x0d\x0b<
  5350. 0: \x09\x0a\x0c\x0d\x0b
  5351. /\s+/
  5352. > \x09\x0a\x0c\x0d\x0b<
  5353. 0: \x09\x0a\x0c\x0d\x0b
  5354. /a b/x
  5355. ab
  5356. 0: ab
  5357. /(?!\A)x/m
  5358. a\nxb\n
  5359. 0: x
  5360. /(?!^)x/m
  5361. a\nxb\n
  5362. No match
  5363. /abc\Qabc\Eabc/
  5364. abcabcabc
  5365. 0: abcabcabc
  5366. /abc\Q(*+|\Eabc/
  5367. abc(*+|abc
  5368. 0: abc(*+|abc
  5369. / abc\Q abc\Eabc/x
  5370. abc abcabc
  5371. 0: abc abcabc
  5372. *** Failers
  5373. No match
  5374. abcabcabc
  5375. No match
  5376. /abc#comment
  5377. \Q#not comment
  5378. literal\E/x
  5379. abc#not comment\n literal
  5380. 0: abc#not comment\x0a literal
  5381. /abc#comment
  5382. \Q#not comment
  5383. literal/x
  5384. abc#not comment\n literal
  5385. 0: abc#not comment\x0a literal
  5386. /abc#comment
  5387. \Q#not comment
  5388. literal\E #more comment
  5389. /x
  5390. abc#not comment\n literal
  5391. 0: abc#not comment\x0a literal
  5392. /abc#comment
  5393. \Q#not comment
  5394. literal\E #more comment/x
  5395. abc#not comment\n literal
  5396. 0: abc#not comment\x0a literal
  5397. /\Qabc\$xyz\E/
  5398. abc\\\$xyz
  5399. 0: abc\$xyz
  5400. /\Qabc\E\$\Qxyz\E/
  5401. abc\$xyz
  5402. 0: abc$xyz
  5403. /\Gabc/
  5404. abc
  5405. 0: abc
  5406. *** Failers
  5407. No match
  5408. xyzabc
  5409. No match
  5410. /\Gabc./g
  5411. abc1abc2xyzabc3
  5412. 0: abc1
  5413. 0: abc2
  5414. /abc./g
  5415. abc1abc2xyzabc3
  5416. 0: abc1
  5417. 0: abc2
  5418. 0: abc3
  5419. /a(?x: b c )d/
  5420. XabcdY
  5421. 0: abcd
  5422. *** Failers
  5423. No match
  5424. Xa b c d Y
  5425. No match
  5426. /((?x)x y z | a b c)/
  5427. XabcY
  5428. 0: abc
  5429. 1: abc
  5430. AxyzB
  5431. 0: xyz
  5432. 1: xyz
  5433. /(?i)AB(?-i)C/
  5434. XabCY
  5435. 0: abC
  5436. *** Failers
  5437. No match
  5438. XabcY
  5439. No match
  5440. /((?i)AB(?-i)C|D)E/
  5441. abCE
  5442. 0: abCE
  5443. 1: abC
  5444. DE
  5445. 0: DE
  5446. 1: D
  5447. *** Failers
  5448. No match
  5449. abcE
  5450. No match
  5451. abCe
  5452. No match
  5453. dE
  5454. No match
  5455. De
  5456. No match
  5457. /(.*)\d+\1/
  5458. abc123abc
  5459. 0: abc123abc
  5460. 1: abc
  5461. abc123bc
  5462. 0: bc123bc
  5463. 1: bc
  5464. /(.*)\d+\1/s
  5465. abc123abc
  5466. 0: abc123abc
  5467. 1: abc
  5468. abc123bc
  5469. 0: bc123bc
  5470. 1: bc
  5471. /((.*))\d+\1/
  5472. abc123abc
  5473. 0: abc123abc
  5474. 1: abc
  5475. 2: abc
  5476. abc123bc
  5477. 0: bc123bc
  5478. 1: bc
  5479. 2: bc
  5480. /-- This tests for an IPv6 address in the form where it can have up to
  5481. eight components, one and only one of which is empty. This must be
  5482. an internal component. --/
  5483. /^(?!:) # colon disallowed at start
  5484. (?: # start of item
  5485. (?: [0-9a-f]{1,4} | # 1-4 hex digits or
  5486. (?(1)0 | () ) ) # if null previously matched, fail; else null
  5487. : # followed by colon
  5488. ){1,7} # end item; 1-7 of them required
  5489. [0-9a-f]{1,4} $ # final hex number at end of string
  5490. (?(1)|.) # check that there was an empty component
  5491. /xi
  5492. a123::a123
  5493. 0: a123::a123
  5494. 1:
  5495. a123:b342::abcd
  5496. 0: a123:b342::abcd
  5497. 1:
  5498. a123:b342::324e:abcd
  5499. 0: a123:b342::324e:abcd
  5500. 1:
  5501. a123:ddde:b342::324e:abcd
  5502. 0: a123:ddde:b342::324e:abcd
  5503. 1:
  5504. a123:ddde:b342::324e:dcba:abcd
  5505. 0: a123:ddde:b342::324e:dcba:abcd
  5506. 1:
  5507. a123:ddde:9999:b342::324e:dcba:abcd
  5508. 0: a123:ddde:9999:b342::324e:dcba:abcd
  5509. 1:
  5510. *** Failers
  5511. No match
  5512. 1:2:3:4:5:6:7:8
  5513. No match
  5514. a123:bce:ddde:9999:b342::324e:dcba:abcd
  5515. No match
  5516. a123::9999:b342::324e:dcba:abcd
  5517. No match
  5518. abcde:2:3:4:5:6:7:8
  5519. No match
  5520. ::1
  5521. No match
  5522. abcd:fee0:123::
  5523. No match
  5524. :1
  5525. No match
  5526. 1:
  5527. No match
  5528. /[z\Qa-d]\E]/
  5529. z
  5530. 0: z
  5531. a
  5532. 0: a
  5533. -
  5534. 0: -
  5535. d
  5536. 0: d
  5537. ]
  5538. 0: ]
  5539. *** Failers
  5540. 0: a
  5541. b
  5542. No match
  5543. /[\z\C]/
  5544. z
  5545. 0: z
  5546. C
  5547. 0: C
  5548. /\M/
  5549. M
  5550. 0: M
  5551. /(a+)*b/
  5552. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  5553. No match
  5554. /(?i)reg(?:ul(?:[aä]|ae)r|ex)/
  5555. REGular
  5556. 0: REGular
  5557. regulaer
  5558. 0: regulaer
  5559. Regex
  5560. 0: Regex
  5561. regulär
  5562. 0: regul\xe4r
  5563. /Åæåä[à-ÿÀ-ß]+/
  5564. Åæåäà
  5565. 0: \xc5\xe6\xe5\xe4\xe0
  5566. Åæåäÿ
  5567. 0: \xc5\xe6\xe5\xe4\xff
  5568. ÅæåäÀ
  5569. 0: \xc5\xe6\xe5\xe4\xc0
  5570. Åæåäß
  5571. 0: \xc5\xe6\xe5\xe4\xdf
  5572. /(?<=Z)X./
  5573. \x84XAZXB
  5574. 0: XB
  5575. /ab cd (?x) de fg/
  5576. ab cd defg
  5577. 0: ab cd defg
  5578. /ab cd(?x) de fg/
  5579. ab cddefg
  5580. 0: ab cddefg
  5581. ** Failers
  5582. No match
  5583. abcddefg
  5584. No match
  5585. /(?<![^f]oo)(bar)/
  5586. foobarX
  5587. 0: bar
  5588. 1: bar
  5589. ** Failers
  5590. No match
  5591. boobarX
  5592. No match
  5593. /(?<![^f])X/
  5594. offX
  5595. 0: X
  5596. ** Failers
  5597. No match
  5598. onyX
  5599. No match
  5600. /(?<=[^f])X/
  5601. onyX
  5602. 0: X
  5603. ** Failers
  5604. No match
  5605. offX
  5606. No match
  5607. /^/mg
  5608. a\nb\nc\n
  5609. 0:
  5610. 0:
  5611. 0:
  5612. \
  5613. 0:
  5614. /(?<=C\n)^/mg
  5615. A\nC\nC\n
  5616. 0:
  5617. /(?:(?(1)a|b)(X))+/
  5618. bXaX
  5619. 0: bXaX
  5620. 1: X
  5621. /(?:(?(1)\1a|b)(X|Y))+/
  5622. bXXaYYaY
  5623. 0: bXXaYYaY
  5624. 1: Y
  5625. bXYaXXaX
  5626. 0: bX
  5627. 1: X
  5628. /()()()()()()()()()(?:(?(10)\10a|b)(X|Y))+/
  5629. bXXaYYaY
  5630. 0: bX
  5631. 1:
  5632. 2:
  5633. 3:
  5634. 4:
  5635. 5:
  5636. 6:
  5637. 7:
  5638. 8:
  5639. 9:
  5640. 10: X
  5641. /[[,abc,]+]/
  5642. abc]
  5643. 0: abc]
  5644. a,b]
  5645. 0: a,b]
  5646. [a,b,c]
  5647. 0: [a,b,c]
  5648. /(?-x: )/x
  5649. A\x20B
  5650. 0:
  5651. "(?x)(?-x: \s*#\s*)"
  5652. A # B
  5653. 0: #
  5654. ** Failers
  5655. No match
  5656. #
  5657. No match
  5658. "(?x-is)(?:(?-ixs) \s*#\s*) include"
  5659. A #include
  5660. 0: #include
  5661. ** Failers
  5662. No match
  5663. A#include
  5664. No match
  5665. A #Include
  5666. No match
  5667. /a*b*\w/
  5668. aaabbbb
  5669. 0: aaabbbb
  5670. aaaa
  5671. 0: aaaa
  5672. a
  5673. 0: a
  5674. /a*b?\w/
  5675. aaabbbb
  5676. 0: aaabb
  5677. aaaa
  5678. 0: aaaa
  5679. a
  5680. 0: a
  5681. /a*b{0,4}\w/
  5682. aaabbbb
  5683. 0: aaabbbb
  5684. aaaa
  5685. 0: aaaa
  5686. a
  5687. 0: a
  5688. /a*b{0,}\w/
  5689. aaabbbb
  5690. 0: aaabbbb
  5691. aaaa
  5692. 0: aaaa
  5693. a
  5694. 0: a
  5695. /a*\d*\w/
  5696. 0a
  5697. 0: 0a
  5698. a
  5699. 0: a
  5700. /a*b *\w/x
  5701. a
  5702. 0: a
  5703. /a*b#comment
  5704. *\w/x
  5705. a
  5706. 0: a
  5707. /a* b *\w/x
  5708. a
  5709. 0: a
  5710. /^\w+=.*(\\\n.*)*/
  5711. abc=xyz\\\npqr
  5712. 0: abc=xyz\
  5713. /(?=(\w+))\1:/
  5714. abcd:
  5715. 0: abcd:
  5716. 1: abcd
  5717. /^(?=(\w+))\1:/
  5718. abcd:
  5719. 0: abcd:
  5720. 1: abcd
  5721. /^\Eabc/
  5722. abc
  5723. 0: abc
  5724. /^[\Eabc]/
  5725. a
  5726. 0: a
  5727. ** Failers
  5728. No match
  5729. E
  5730. No match
  5731. /^[a-\Ec]/
  5732. b
  5733. 0: b
  5734. ** Failers
  5735. No match
  5736. -
  5737. No match
  5738. E
  5739. No match
  5740. /^[a\E\E-\Ec]/
  5741. b
  5742. 0: b
  5743. ** Failers
  5744. No match
  5745. -
  5746. No match
  5747. E
  5748. No match
  5749. /^[\E\Qa\E-\Qz\E]+/
  5750. b
  5751. 0: b
  5752. ** Failers
  5753. No match
  5754. -
  5755. No match
  5756. /^[a\Q]bc\E]/
  5757. a
  5758. 0: a
  5759. ]
  5760. 0: ]
  5761. c
  5762. 0: c
  5763. /^[a-\Q\E]/
  5764. a
  5765. 0: a
  5766. -
  5767. 0: -
  5768. /^(a()*)*/
  5769. aaaa
  5770. 0: aaaa
  5771. 1: a
  5772. 2:
  5773. /^(?:a(?:(?:))*)*/
  5774. aaaa
  5775. 0: aaaa
  5776. /^(a()+)+/
  5777. aaaa
  5778. 0: aaaa
  5779. 1: a
  5780. 2:
  5781. /^(?:a(?:(?:))+)+/
  5782. aaaa
  5783. 0: aaaa
  5784. /(a){0,3}(?(1)b|(c|))*D/
  5785. abbD
  5786. 0: abbD
  5787. 1: a
  5788. ccccD
  5789. 0: ccccD
  5790. 1: <unset>
  5791. 2:
  5792. D
  5793. 0: D
  5794. 1: <unset>
  5795. 2:
  5796. /(a|)*\d/
  5797. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  5798. No match
  5799. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  5800. 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  5801. 1:
  5802. /(?>a|)*\d/
  5803. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  5804. No match
  5805. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  5806. 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  5807. /(?:a|)*\d/
  5808. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  5809. No match
  5810. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  5811. 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  5812. /\Z/g
  5813. abc\n
  5814. 0:
  5815. 0:
  5816. /^(?s)(?>.*)(?<!\n)/
  5817. abc
  5818. 0: abc
  5819. abc\n
  5820. No match
  5821. /^(?![^\n]*\n\z)/
  5822. abc
  5823. 0:
  5824. abc\n
  5825. No match
  5826. /\z(?<!\n)/
  5827. abc
  5828. 0:
  5829. abc\n
  5830. No match
  5831. /(.*(.)?)*/
  5832. abcd
  5833. 0: abcd
  5834. 1:
  5835. /( (A | (?(1)0|) )* )/x
  5836. abcd
  5837. 0:
  5838. 1:
  5839. 2:
  5840. /( ( (?(1)0|) )* )/x
  5841. abcd
  5842. 0:
  5843. 1:
  5844. 2:
  5845. /( (?(1)0|)* )/x
  5846. abcd
  5847. 0:
  5848. 1:
  5849. /[[:abcd:xyz]]/
  5850. a]
  5851. 0: a]
  5852. :]
  5853. 0: :]
  5854. /[abc[:x\]pqr]/
  5855. a
  5856. 0: a
  5857. [
  5858. 0: [
  5859. :
  5860. 0: :
  5861. ]
  5862. 0: ]
  5863. p
  5864. 0: p
  5865. /.*[op][xyz]/
  5866. fooabcfoo
  5867. No match
  5868. /(?(?=.*b)b|^)/
  5869. adc
  5870. 0:
  5871. abc
  5872. 0: b
  5873. /(?(?=^.*b)b|^)/
  5874. adc
  5875. 0:
  5876. abc
  5877. No match
  5878. /(?(?=.*b)b|^)*/
  5879. adc
  5880. 0:
  5881. abc
  5882. 0:
  5883. /(?(?=.*b)b|^)+/
  5884. adc
  5885. 0:
  5886. abc
  5887. 0: b
  5888. /(?(?=b).*b|^d)/
  5889. abc
  5890. 0: b
  5891. /(?(?=.*b).*b|^d)/
  5892. abc
  5893. 0: ab
  5894. /^%((?(?=[a])[^%])|b)*%$/
  5895. %ab%
  5896. 0: %ab%
  5897. 1:
  5898. /(?i)a(?-i)b|c/
  5899. XabX
  5900. 0: ab
  5901. XAbX
  5902. 0: Ab
  5903. CcC
  5904. 0: c
  5905. ** Failers
  5906. No match
  5907. XABX
  5908. No match
  5909. /[\x00-\xff\s]+/
  5910. \x0a\x0b\x0c\x0d
  5911. 0: \x0a\x0b\x0c\x0d
  5912. /^\c/
  5913. ?
  5914. 0: ?
  5915. /(abc)\1/i
  5916. abc
  5917. No match
  5918. /(abc)\1/
  5919. abc
  5920. No match
  5921. /[^a]*/i
  5922. 12abc
  5923. 0: 12
  5924. 12ABC
  5925. 0: 12
  5926. /[^a]*+/i
  5927. 12abc
  5928. 0: 12
  5929. 12ABC
  5930. 0: 12
  5931. /[^a]*?X/i
  5932. ** Failers
  5933. No match
  5934. 12abc
  5935. No match
  5936. 12ABC
  5937. No match
  5938. /[^a]+?X/i
  5939. ** Failers
  5940. No match
  5941. 12abc
  5942. No match
  5943. 12ABC
  5944. No match
  5945. /[^a]?X/i
  5946. 12aXbcX
  5947. 0: X
  5948. 12AXBCX
  5949. 0: X
  5950. BCX
  5951. 0: CX
  5952. /[^a]??X/i
  5953. 12aXbcX
  5954. 0: X
  5955. 12AXBCX
  5956. 0: X
  5957. BCX
  5958. 0: CX
  5959. /[^a]?+X/i
  5960. 12aXbcX
  5961. 0: cX
  5962. 12AXBCX
  5963. 0: CX
  5964. BCX
  5965. 0: CX
  5966. /[^a]{2,3}/i
  5967. abcdef
  5968. 0: bcd
  5969. ABCDEF
  5970. 0: BCD
  5971. /[^a]{2,3}?/i
  5972. abcdef
  5973. 0: bc
  5974. ABCDEF
  5975. 0: BC
  5976. /[^a]{2,3}+/i
  5977. abcdef
  5978. 0: bcd
  5979. ABCDEF
  5980. 0: BCD
  5981. /((a|)+)+Z/
  5982. Z
  5983. 0: Z
  5984. 1:
  5985. 2:
  5986. /(a)b|(a)c/
  5987. ac
  5988. 0: ac
  5989. 1: <unset>
  5990. 2: a
  5991. /(?>(a))b|(a)c/
  5992. ac
  5993. 0: ac
  5994. 1: <unset>
  5995. 2: a
  5996. /(?=(a))ab|(a)c/
  5997. ac
  5998. 0: ac
  5999. 1: <unset>
  6000. 2: a
  6001. /((?>(a))b|(a)c)/
  6002. ac
  6003. 0: ac
  6004. 1: ac
  6005. 2: <unset>
  6006. 3: a
  6007. /((?>(a))b|(a)c)++/
  6008. ac
  6009. 0: ac
  6010. 1: ac
  6011. 2: <unset>
  6012. 3: a
  6013. /(?:(?>(a))b|(a)c)++/
  6014. ac
  6015. 0: ac
  6016. 1: <unset>
  6017. 2: a
  6018. /(?=(?>(a))b|(a)c)(..)/
  6019. ac
  6020. 0: ac
  6021. 1: <unset>
  6022. 2: a
  6023. 3: ac
  6024. /(?>(?>(a))b|(a)c)/
  6025. ac
  6026. 0: ac
  6027. 1: <unset>
  6028. 2: a
  6029. /(?:(?>([ab])))+a=/+
  6030. =ba=
  6031. 0: ba=
  6032. 0+
  6033. 1: b
  6034. /(?>([ab]))+a=/+
  6035. =ba=
  6036. 0: ba=
  6037. 0+
  6038. 1: b
  6039. /((?>(a+)b)+(aabab))/
  6040. aaaabaaabaabab
  6041. 0: aaaabaaabaabab
  6042. 1: aaaabaaabaabab
  6043. 2: aaa
  6044. 3: aabab
  6045. /(?>a+|ab)+?c/
  6046. aabc
  6047. No match
  6048. /(?>a+|ab)+c/
  6049. aabc
  6050. No match
  6051. /(?:a+|ab)+c/
  6052. aabc
  6053. 0: aabc
  6054. /(?(?=(a))a)/
  6055. a
  6056. 0: a
  6057. 1: a
  6058. /(?(?=(a))a)(b)/
  6059. ab
  6060. 0: ab
  6061. 1: a
  6062. 2: b
  6063. /^(?:a|ab)++c/
  6064. aaaabc
  6065. No match
  6066. /^(?>a|ab)++c/
  6067. aaaabc
  6068. No match
  6069. /^(?:a|ab)+c/
  6070. aaaabc
  6071. 0: aaaabc
  6072. /(?=abc){3}abc/+
  6073. abcabcabc
  6074. 0: abc
  6075. 0+ abcabc
  6076. ** Failers
  6077. No match
  6078. xyz
  6079. No match
  6080. /(?=abc)+abc/+
  6081. abcabcabc
  6082. 0: abc
  6083. 0+ abcabc
  6084. ** Failers
  6085. No match
  6086. xyz
  6087. No match
  6088. /(?=abc)++abc/+
  6089. abcabcabc
  6090. 0: abc
  6091. 0+ abcabc
  6092. ** Failers
  6093. No match
  6094. xyz
  6095. No match
  6096. /(?=abc){0}xyz/
  6097. xyz
  6098. 0: xyz
  6099. /(?=abc){1}xyz/
  6100. ** Failers
  6101. No match
  6102. xyz
  6103. No match
  6104. /(?=(a))?./
  6105. ab
  6106. 0: a
  6107. 1: a
  6108. bc
  6109. 0: b
  6110. /(?=(a))??./
  6111. ab
  6112. 0: a
  6113. bc
  6114. 0: b
  6115. /^(?=(?1))?[az]([abc])d/
  6116. abd
  6117. 0: abd
  6118. 1: b
  6119. zcdxx
  6120. 0: zcd
  6121. 1: c
  6122. /^(?!a){0}\w+/
  6123. aaaaa
  6124. 0: aaaaa
  6125. /(?<=(abc))?xyz/
  6126. abcxyz
  6127. 0: xyz
  6128. 1: abc
  6129. pqrxyz
  6130. 0: xyz
  6131. /^[\g<a>]+/
  6132. ggg<<<aaa>>>
  6133. 0: ggg<<<aaa>>>
  6134. ** Failers
  6135. No match
  6136. \\ga
  6137. No match
  6138. /^[\ga]+/
  6139. gggagagaxyz
  6140. 0: gggagaga
  6141. /^[:a[:digit:]]+/
  6142. aaaa444:::Z
  6143. 0: aaaa444:::
  6144. /^[:a[:digit:]:b]+/
  6145. aaaa444:::bbbZ
  6146. 0: aaaa444:::bbb
  6147. /[:a]xxx[b:]/
  6148. :xxx:
  6149. 0: :xxx:
  6150. /(?<=a{2})b/i
  6151. xaabc
  6152. 0: b
  6153. ** Failers
  6154. No match
  6155. xabc
  6156. No match
  6157. /(?<!a{2})b/i
  6158. xabc
  6159. 0: b
  6160. ** Failers
  6161. No match
  6162. xaabc
  6163. No match
  6164. /(?<=a\h)c/
  6165. xa c
  6166. 0: c
  6167. /(?<=[^a]{2})b/
  6168. axxbc
  6169. 0: b
  6170. aAAbc
  6171. 0: b
  6172. ** Failers
  6173. No match
  6174. xaabc
  6175. No match
  6176. /(?<=[^a]{2})b/i
  6177. axxbc
  6178. 0: b
  6179. ** Failers
  6180. No match
  6181. aAAbc
  6182. No match
  6183. xaabc
  6184. No match
  6185. /(?<=a\H)c/
  6186. abc
  6187. 0: c
  6188. /(?<=a\V)c/
  6189. abc
  6190. 0: c
  6191. /(?<=a\v)c/
  6192. a\nc
  6193. 0: c
  6194. /(?(?=c)c|d)++Y/
  6195. XcccddYX
  6196. 0: cccddY
  6197. /(?(?=c)c|d)*+Y/
  6198. XcccddYX
  6199. 0: cccddY
  6200. /^(a{2,3}){2,}+a/
  6201. aaaaaaa
  6202. 0: aaaaaaa
  6203. 1: aaa
  6204. ** Failers
  6205. No match
  6206. aaaaaa
  6207. No match
  6208. aaaaaaaaa
  6209. No match
  6210. /^(a{2,3})++a/
  6211. ** Failers
  6212. No match
  6213. aaaaaa
  6214. No match
  6215. /^(a{2,3})*+a/
  6216. ** Failers
  6217. No match
  6218. aaaaaa
  6219. No match
  6220. /ab\Cde/
  6221. abXde
  6222. 0: abXde
  6223. /(?<=ab\Cde)X/
  6224. abZdeX
  6225. 0: X
  6226. /a[\CD]b/
  6227. aCb
  6228. 0: aCb
  6229. aDb
  6230. 0: aDb
  6231. /a[\C-X]b/
  6232. aJb
  6233. 0: aJb
  6234. /\H\h\V\v/
  6235. X X\x0a
  6236. 0: X X\x0a
  6237. X\x09X\x0b
  6238. 0: X\x09X\x0b
  6239. ** Failers
  6240. No match
  6241. \xa0 X\x0a
  6242. No match
  6243. /\H*\h+\V?\v{3,4}/
  6244. \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
  6245. 0: \x09 \xa0X\x0a\x0b\x0c\x0d
  6246. \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
  6247. 0: \x09 \xa0\x0a\x0b\x0c\x0d
  6248. \x09\x20\xa0\x0a\x0b\x0c
  6249. 0: \x09 \xa0\x0a\x0b\x0c
  6250. ** Failers
  6251. No match
  6252. \x09\x20\xa0\x0a\x0b
  6253. No match
  6254. /\H{3,4}/
  6255. XY ABCDE
  6256. 0: ABCD
  6257. XY PQR ST
  6258. 0: PQR
  6259. /.\h{3,4}./
  6260. XY AB PQRS
  6261. 0: B P
  6262. /\h*X\h?\H+Y\H?Z/
  6263. >XNNNYZ
  6264. 0: XNNNYZ
  6265. > X NYQZ
  6266. 0: X NYQZ
  6267. ** Failers
  6268. No match
  6269. >XYZ
  6270. No match
  6271. > X NY Z
  6272. No match
  6273. /\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
  6274. >XY\x0aZ\x0aA\x0bNN\x0c
  6275. 0: XY\x0aZ\x0aA\x0bNN\x0c
  6276. >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
  6277. 0: \x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
  6278. /(foo)\Kbar/
  6279. foobar
  6280. 0: bar
  6281. 1: foo
  6282. /(foo)(\Kbar|baz)/
  6283. foobar
  6284. 0: bar
  6285. 1: foo
  6286. 2: bar
  6287. foobaz
  6288. 0: foobaz
  6289. 1: foo
  6290. 2: baz
  6291. /(foo\Kbar)baz/
  6292. foobarbaz
  6293. 0: barbaz
  6294. 1: foobar
  6295. /abc\K|def\K/g+
  6296. Xabcdefghi
  6297. 0:
  6298. 0+ defghi
  6299. 0:
  6300. 0+ ghi
  6301. /ab\Kc|de\Kf/g+
  6302. Xabcdefghi
  6303. 0: c
  6304. 0+ defghi
  6305. 0: f
  6306. 0+ ghi
  6307. /(?=C)/g+
  6308. ABCDECBA
  6309. 0:
  6310. 0+ CDECBA
  6311. 0:
  6312. 0+ CBA
  6313. /^abc\K/+
  6314. abcdef
  6315. 0:
  6316. 0+ def
  6317. ** Failers
  6318. No match
  6319. defabcxyz
  6320. No match
  6321. /^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
  6322. ababababbbabZXXXX
  6323. 0: ababababbbabZ
  6324. 1: ab
  6325. 2: b
  6326. /(?<A>tom|bon)-\g{A}/
  6327. tom-tom
  6328. 0: tom-tom
  6329. 1: tom
  6330. bon-bon
  6331. 0: bon-bon
  6332. 1: bon
  6333. /(^(a|b\g{-1}))/
  6334. bacxxx
  6335. No match
  6336. /(?|(abc)|(xyz))\1/
  6337. abcabc
  6338. 0: abcabc
  6339. 1: abc
  6340. xyzxyz
  6341. 0: xyzxyz
  6342. 1: xyz
  6343. ** Failers
  6344. No match
  6345. abcxyz
  6346. No match
  6347. xyzabc
  6348. No match
  6349. /(?|(abc)|(xyz))(?1)/
  6350. abcabc
  6351. 0: abcabc
  6352. 1: abc
  6353. xyzabc
  6354. 0: xyzabc
  6355. 1: xyz
  6356. ** Failers
  6357. No match
  6358. xyzxyz
  6359. No match
  6360. /^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/
  6361. XYabcdY
  6362. 0: XYabcdY
  6363. 1: a
  6364. 2: b
  6365. 3: c
  6366. 4: d
  6367. 5: Y
  6368. /^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/
  6369. XYabcdY
  6370. 0: XYabcdY
  6371. 1: a
  6372. 2: b
  6373. 3: <unset>
  6374. 4: <unset>
  6375. 5: c
  6376. 6: d
  6377. 7: Y
  6378. /^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/
  6379. XYabcdY
  6380. 0: XYabcdY
  6381. 1: a
  6382. 2: b
  6383. 3: <unset>
  6384. 4: <unset>
  6385. 5: c
  6386. 6: d
  6387. 7: Y
  6388. /(?'abc'\w+):\k<abc>{2}/
  6389. a:aaxyz
  6390. 0: a:aa
  6391. 1: a
  6392. ab:ababxyz
  6393. 0: ab:abab
  6394. 1: ab
  6395. ** Failers
  6396. No match
  6397. a:axyz
  6398. No match
  6399. ab:abxyz
  6400. No match
  6401. /(?'abc'\w+):\g{abc}{2}/
  6402. a:aaxyz
  6403. 0: a:aa
  6404. 1: a
  6405. ab:ababxyz
  6406. 0: ab:abab
  6407. 1: ab
  6408. ** Failers
  6409. No match
  6410. a:axyz
  6411. No match
  6412. ab:abxyz
  6413. No match
  6414. /^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x
  6415. abd
  6416. 0: abd
  6417. 1: a
  6418. ce
  6419. 0: ce
  6420. /^(a.)\g-1Z/
  6421. aXaXZ
  6422. 0: aXaXZ
  6423. 1: aX
  6424. /^(a.)\g{-1}Z/
  6425. aXaXZ
  6426. 0: aXaXZ
  6427. 1: aX
  6428. /^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) /x
  6429. abcd
  6430. 0: ab
  6431. /(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
  6432. (?(DEFINE)
  6433. (?<NAME_PAT>[a-z]+)
  6434. (?<ADDRESS_PAT>\d+)
  6435. )/x
  6436. metcalfe 33
  6437. 0: metcalfe 33
  6438. 1: metcalfe
  6439. 2: 33
  6440. /(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/
  6441. 1.2.3.4
  6442. 0: 1.2.3.4
  6443. 1: <unset>
  6444. 2: .4
  6445. 131.111.10.206
  6446. 0: 131.111.10.206
  6447. 1: <unset>
  6448. 2: .206
  6449. 10.0.0.0
  6450. 0: 10.0.0.0
  6451. 1: <unset>
  6452. 2: .0
  6453. ** Failers
  6454. No match
  6455. 10.6
  6456. No match
  6457. 455.3.4.5
  6458. No match
  6459. /\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/
  6460. 1.2.3.4
  6461. 0: 1.2.3.4
  6462. 1: .4
  6463. 131.111.10.206
  6464. 0: 131.111.10.206
  6465. 1: .206
  6466. 10.0.0.0
  6467. 0: 10.0.0.0
  6468. 1: .0
  6469. ** Failers
  6470. No match
  6471. 10.6
  6472. No match
  6473. 455.3.4.5
  6474. No match
  6475. /^(\w++|\s++)*$/
  6476. now is the time for all good men to come to the aid of the party
  6477. 0: now is the time for all good men to come to the aid of the party
  6478. 1: party
  6479. *** Failers
  6480. No match
  6481. this is not a line with only words and spaces!
  6482. No match
  6483. /(\d++)(\w)/
  6484. 12345a
  6485. 0: 12345a
  6486. 1: 12345
  6487. 2: a
  6488. *** Failers
  6489. No match
  6490. 12345+
  6491. No match
  6492. /a++b/
  6493. aaab
  6494. 0: aaab
  6495. /(a++b)/
  6496. aaab
  6497. 0: aaab
  6498. 1: aaab
  6499. /(a++)b/
  6500. aaab
  6501. 0: aaab
  6502. 1: aaa
  6503. /([^()]++|\([^()]*\))+/
  6504. ((abc(ade)ufh()()x
  6505. 0: abc(ade)ufh()()x
  6506. 1: x
  6507. /\(([^()]++|\([^()]+\))+\)/
  6508. (abc)
  6509. 0: (abc)
  6510. 1: abc
  6511. (abc(def)xyz)
  6512. 0: (abc(def)xyz)
  6513. 1: xyz
  6514. *** Failers
  6515. No match
  6516. ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  6517. No match
  6518. /^([^()]|\((?1)*\))*$/
  6519. abc
  6520. 0: abc
  6521. 1: c
  6522. a(b)c
  6523. 0: a(b)c
  6524. 1: c
  6525. a(b(c))d
  6526. 0: a(b(c))d
  6527. 1: d
  6528. *** Failers)
  6529. No match
  6530. a(b(c)d
  6531. No match
  6532. /^>abc>([^()]|\((?1)*\))*<xyz<$/
  6533. >abc>123<xyz<
  6534. 0: >abc>123<xyz<
  6535. 1: 3
  6536. >abc>1(2)3<xyz<
  6537. 0: >abc>1(2)3<xyz<
  6538. 1: 3
  6539. >abc>(1(2)3)<xyz<
  6540. 0: >abc>(1(2)3)<xyz<
  6541. 1: (1(2)3)
  6542. /^(?:((.)(?1)\2|)|((.)(?3)\4|.))$/i
  6543. 1221
  6544. 0: 1221
  6545. 1: 1221
  6546. 2: 1
  6547. Satanoscillatemymetallicsonatas
  6548. 0: Satanoscillatemymetallicsonatas
  6549. 1: <unset>
  6550. 2: <unset>
  6551. 3: Satanoscillatemymetallicsonatas
  6552. 4: S
  6553. AmanaplanacanalPanama
  6554. 0: AmanaplanacanalPanama
  6555. 1: <unset>
  6556. 2: <unset>
  6557. 3: AmanaplanacanalPanama
  6558. 4: A
  6559. AblewasIereIsawElba
  6560. 0: AblewasIereIsawElba
  6561. 1: <unset>
  6562. 2: <unset>
  6563. 3: AblewasIereIsawElba
  6564. 4: A
  6565. *** Failers
  6566. No match
  6567. Thequickbrownfox
  6568. No match
  6569. /^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
  6570. 12
  6571. 0: 12
  6572. 1: 12
  6573. (((2+2)*-3)-7)
  6574. 0: (((2+2)*-3)-7)
  6575. 1: (((2+2)*-3)-7)
  6576. 2: -
  6577. -12
  6578. 0: -12
  6579. 1: -12
  6580. *** Failers
  6581. No match
  6582. ((2+2)*-3)-7)
  6583. No match
  6584. /^(x(y|(?1){2})z)/
  6585. xyz
  6586. 0: xyz
  6587. 1: xyz
  6588. 2: y
  6589. xxyzxyzz
  6590. 0: xxyzxyzz
  6591. 1: xxyzxyzz
  6592. 2: xyzxyz
  6593. *** Failers
  6594. No match
  6595. xxyzz
  6596. No match
  6597. xxyzxyzxyzz
  6598. No match
  6599. /((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/x
  6600. <>
  6601. 0: <>
  6602. 1: <>
  6603. 2: <>
  6604. <abcd>
  6605. 0: <abcd>
  6606. 1: <abcd>
  6607. 2: <abcd>
  6608. <abc <123> hij>
  6609. 0: <abc <123> hij>
  6610. 1: <abc <123> hij>
  6611. 2: <abc <123> hij>
  6612. <abc <def> hij>
  6613. 0: <def>
  6614. 1: <def>
  6615. 2: <def>
  6616. <abc<>def>
  6617. 0: <abc<>def>
  6618. 1: <abc<>def>
  6619. 2: <abc<>def>
  6620. <abc<>
  6621. 0: <>
  6622. 1: <>
  6623. 2: <>
  6624. *** Failers
  6625. No match
  6626. <abc
  6627. No match
  6628. /^a+(*FAIL)/
  6629. aaaaaa
  6630. No match
  6631. /a+b?c+(*FAIL)/
  6632. aaabccc
  6633. No match
  6634. /a+b?(*PRUNE)c+(*FAIL)/
  6635. aaabccc
  6636. No match
  6637. /a+b?(*COMMIT)c+(*FAIL)/
  6638. aaabccc
  6639. No match
  6640. /a+b?(*SKIP)c+(*FAIL)/
  6641. aaabcccaaabccc
  6642. No match
  6643. /^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
  6644. aaaxxxxxx
  6645. 0: aaaxxxxxx
  6646. aaa++++++
  6647. 0: aaa
  6648. bbbxxxxx
  6649. 0: bbbxxxxx
  6650. bbb+++++
  6651. 0: bbb
  6652. cccxxxx
  6653. 0: cccxxxx
  6654. ccc++++
  6655. 0: ccc
  6656. dddddddd
  6657. 0: ddd
  6658. /^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
  6659. aaaxxxxxx
  6660. 0: aaaxxxxxx
  6661. 1: aaaxxxxxx
  6662. aaa++++++
  6663. 0: aaa
  6664. 1: aaa
  6665. bbbxxxxx
  6666. 0: bbbxxxxx
  6667. 1: bbbxxxxx
  6668. bbb+++++
  6669. 0: bbb
  6670. 1: bbb
  6671. cccxxxx
  6672. 0: cccxxxx
  6673. 1: cccxxxx
  6674. ccc++++
  6675. 0: ccc
  6676. 1: ccc
  6677. dddddddd
  6678. 0: ddd
  6679. 1: ddd
  6680. /a+b?(*THEN)c+(*FAIL)/
  6681. aaabccc
  6682. No match
  6683. /(A (A|B(*ACCEPT)|C) D)(E)/x
  6684. AB
  6685. 0: AB
  6686. 1: AB
  6687. 2: B
  6688. ABX
  6689. 0: AB
  6690. 1: AB
  6691. 2: B
  6692. AADE
  6693. 0: AADE
  6694. 1: AAD
  6695. 2: A
  6696. 3: E
  6697. ACDE
  6698. 0: ACDE
  6699. 1: ACD
  6700. 2: C
  6701. 3: E
  6702. ** Failers
  6703. No match
  6704. AD
  6705. No match
  6706. /^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i
  6707. 1221
  6708. 0: 1221
  6709. 1: 1221
  6710. 2: 1
  6711. Satan, oscillate my metallic sonatas!
  6712. 0: Satan, oscillate my metallic sonatas!
  6713. 1: <unset>
  6714. 2: <unset>
  6715. 3: Satan, oscillate my metallic sonatas
  6716. 4: S
  6717. A man, a plan, a canal: Panama!
  6718. 0: A man, a plan, a canal: Panama!
  6719. 1: <unset>
  6720. 2: <unset>
  6721. 3: A man, a plan, a canal: Panama
  6722. 4: A
  6723. Able was I ere I saw Elba.
  6724. 0: Able was I ere I saw Elba.
  6725. 1: <unset>
  6726. 2: <unset>
  6727. 3: Able was I ere I saw Elba
  6728. 4: A
  6729. *** Failers
  6730. No match
  6731. The quick brown fox
  6732. No match
  6733. /^((.)(?1)\2|.)$/
  6734. a
  6735. 0: a
  6736. 1: a
  6737. aba
  6738. 0: aba
  6739. 1: aba
  6740. 2: a
  6741. aabaa
  6742. 0: aabaa
  6743. 1: aabaa
  6744. 2: a
  6745. abcdcba
  6746. 0: abcdcba
  6747. 1: abcdcba
  6748. 2: a
  6749. pqaabaaqp
  6750. 0: pqaabaaqp
  6751. 1: pqaabaaqp
  6752. 2: p
  6753. ablewasiereisawelba
  6754. 0: ablewasiereisawelba
  6755. 1: ablewasiereisawelba
  6756. 2: a
  6757. rhubarb
  6758. No match
  6759. the quick brown fox
  6760. No match
  6761. /(a)(?<=b(?1))/
  6762. baz
  6763. 0: a
  6764. 1: a
  6765. ** Failers
  6766. No match
  6767. caz
  6768. No match
  6769. /(?<=b(?1))(a)/
  6770. zbaaz
  6771. 0: a
  6772. 1: a
  6773. ** Failers
  6774. No match
  6775. aaa
  6776. No match
  6777. /(?<X>a)(?<=b(?&X))/
  6778. baz
  6779. 0: a
  6780. 1: a
  6781. /^(?|(abc)|(def))\1/
  6782. abcabc
  6783. 0: abcabc
  6784. 1: abc
  6785. defdef
  6786. 0: defdef
  6787. 1: def
  6788. ** Failers
  6789. No match
  6790. abcdef
  6791. No match
  6792. defabc
  6793. No match
  6794. /^(?|(abc)|(def))(?1)/
  6795. abcabc
  6796. 0: abcabc
  6797. 1: abc
  6798. defabc
  6799. 0: defabc
  6800. 1: def
  6801. ** Failers
  6802. No match
  6803. defdef
  6804. No match
  6805. abcdef
  6806. No match
  6807. /(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |b(?<quote> (?<apostrophe>')|(?<realquote>")) ) (?('quote')[a-z]+|[0-9]+)/xJ
  6808. a\"aaaaa
  6809. 0: a"aaaaa
  6810. 1: "
  6811. 2: <unset>
  6812. 3: "
  6813. b\"aaaaa
  6814. 0: b"aaaaa
  6815. 1: <unset>
  6816. 2: <unset>
  6817. 3: <unset>
  6818. 4: "
  6819. 5: <unset>
  6820. 6: "
  6821. ** Failers
  6822. No match
  6823. b\"11111
  6824. No match
  6825. /(?:(?1)|B)(A(*F)|C)/
  6826. ABCD
  6827. 0: BC
  6828. 1: C
  6829. CCD
  6830. 0: CC
  6831. 1: C
  6832. ** Failers
  6833. No match
  6834. CAD
  6835. No match
  6836. /^(?:(?1)|B)(A(*F)|C)/
  6837. CCD
  6838. 0: CC
  6839. 1: C
  6840. BCD
  6841. 0: BC
  6842. 1: C
  6843. ** Failers
  6844. No match
  6845. ABCD
  6846. No match
  6847. CAD
  6848. No match
  6849. BAD
  6850. No match
  6851. /(?:(?1)|B)(A(*ACCEPT)XX|C)D/
  6852. AAD
  6853. 0: AA
  6854. 1: A
  6855. ACD
  6856. 0: ACD
  6857. 1: C
  6858. BAD
  6859. 0: BA
  6860. 1: A
  6861. BCD
  6862. 0: BCD
  6863. 1: C
  6864. BAX
  6865. 0: BA
  6866. 1: A
  6867. ** Failers
  6868. No match
  6869. ACX
  6870. No match
  6871. ABC
  6872. No match
  6873. /(?(DEFINE)(A))B(?1)C/
  6874. BAC
  6875. 0: BAC
  6876. /(?(DEFINE)((A)\2))B(?1)C/
  6877. BAAC
  6878. 0: BAAC
  6879. /(?<pn> \( ( [^()]++ | (?&pn) )* \) )/x
  6880. (ab(cd)ef)
  6881. 0: (ab(cd)ef)
  6882. 1: (ab(cd)ef)
  6883. 2: ef
  6884. /^(?=a(*SKIP)b|ac)/
  6885. ** Failers
  6886. No match
  6887. ac
  6888. No match
  6889. /^(?=a(*PRUNE)b)/
  6890. ab
  6891. 0:
  6892. ** Failers
  6893. No match
  6894. ac
  6895. No match
  6896. /^(?=a(*ACCEPT)b)/
  6897. ac
  6898. 0:
  6899. /(?>a\Kb)/
  6900. ab
  6901. 0: b
  6902. /((?>a\Kb))/
  6903. ab
  6904. 0: b
  6905. 1: ab
  6906. /(a\Kb)/
  6907. ab
  6908. 0: b
  6909. 1: ab
  6910. /^a\Kcz|ac/
  6911. ac
  6912. 0: ac
  6913. /(?>a\Kbz|ab)/
  6914. ab
  6915. 0: ab
  6916. /^(?&t)(?(DEFINE)(?<t>a\Kb))$/
  6917. ab
  6918. 0: b
  6919. /^([^()]|\((?1)*\))*$/
  6920. a(b)c
  6921. 0: a(b)c
  6922. 1: c
  6923. a(b(c)d)e
  6924. 0: a(b(c)d)e
  6925. 1: e
  6926. /(?P<L1>(?P<L2>0)(?P>L1)|(?P>L2))/
  6927. 0
  6928. 0: 0
  6929. 1: 0
  6930. 00
  6931. 0: 00
  6932. 1: 00
  6933. 2: 0
  6934. 0000
  6935. 0: 0000
  6936. 1: 0000
  6937. 2: 0
  6938. /(?P<L1>(?P<L2>0)|(?P>L2)(?P>L1))/
  6939. 0
  6940. 0: 0
  6941. 1: 0
  6942. 2: 0
  6943. 00
  6944. 0: 0
  6945. 1: 0
  6946. 2: 0
  6947. 0000
  6948. 0: 0
  6949. 1: 0
  6950. 2: 0
  6951. /--- This one does fail, as expected, in Perl. It needs the complex item at the
  6952. end of the pattern. A single letter instead of (B|D) makes it not fail,
  6953. which I think is a Perl bug. --- /
  6954. /A(*COMMIT)(B|D)/
  6955. ACABX
  6956. No match
  6957. /--- Check the use of names for failure ---/
  6958. /^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K
  6959. ** Failers
  6960. No match
  6961. AC
  6962. No match, mark = A
  6963. CB
  6964. No match, mark = B
  6965. /--- Force no study, otherwise mark is not seen. The studied version is in
  6966. test 2 because it isn't Perl-compatible. ---/
  6967. /(*MARK:A)(*SKIP:B)(C|X)/KSS
  6968. C
  6969. 0: C
  6970. 1: C
  6971. MK: A
  6972. D
  6973. No match, mark = A
  6974. /^(A(*THEN:A)B|C(*THEN:B)D)/K
  6975. ** Failers
  6976. No match
  6977. CB
  6978. No match, mark = B
  6979. /^(?:A(*THEN:A)B|C(*THEN:B)D)/K
  6980. CB
  6981. No match, mark = B
  6982. /^(?>A(*THEN:A)B|C(*THEN:B)D)/K
  6983. CB
  6984. No match, mark = B
  6985. /--- This should succeed, as the skip causes bump to offset 1 (the mark). Note
  6986. that we have to have something complicated such as (B|Z) at the end because,
  6987. for Perl, a simple character somehow causes an unwanted optimization to mess
  6988. with the handling of backtracking verbs. ---/
  6989. /A(*MARK:A)A+(*SKIP:A)(B|Z) | AC/xK
  6990. AAAC
  6991. 0: AC
  6992. /--- Test skipping over a non-matching mark. ---/
  6993. /A(*MARK:A)A+(*MARK:B)(*SKIP:A)(B|Z) | AC/xK
  6994. AAAC
  6995. 0: AC
  6996. /--- Check shorthand for MARK ---/
  6997. /A(*:A)A+(*SKIP:A)(B|Z) | AC/xK
  6998. AAAC
  6999. 0: AC
  7000. /--- Don't loop! Force no study, otherwise mark is not seen. ---/
  7001. /(*:A)A+(*SKIP:A)(B|Z)/KSS
  7002. AAAC
  7003. No match, mark = A
  7004. /--- This should succeed, as a non-existent skip name disables the skip ---/
  7005. /A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK
  7006. AAAC
  7007. 0: AC
  7008. /A(*MARK:A)A+(*SKIP:B)(B|Z) | AC(*:B)/xK
  7009. AAAC
  7010. 0: AC
  7011. MK: B
  7012. /--- COMMIT at the start of a pattern should act like an anchor. Again,
  7013. however, we need the complication for Perl. ---/
  7014. /(*COMMIT)(A|P)(B|P)(C|P)/
  7015. ABCDEFG
  7016. 0: ABC
  7017. 1: A
  7018. 2: B
  7019. 3: C
  7020. ** Failers
  7021. No match
  7022. DEFGABC
  7023. No match
  7024. /--- COMMIT inside an atomic group can't stop backtracking over the group. ---/
  7025. /(\w+)(?>b(*COMMIT))\w{2}/
  7026. abbb
  7027. 0: abbb
  7028. 1: a
  7029. /(\w+)b(*COMMIT)\w{2}/
  7030. abbb
  7031. No match
  7032. /--- Check opening parens in comment when seeking forward reference. ---/
  7033. /(?&t)(?#()(?(DEFINE)(?<t>a))/
  7034. bac
  7035. 0: a
  7036. /--- COMMIT should override THEN ---/
  7037. /(?>(*COMMIT)(?>yes|no)(*THEN)(*F))?/
  7038. yes
  7039. No match
  7040. /(?>(*COMMIT)(yes|no)(*THEN)(*F))?/
  7041. yes
  7042. No match
  7043. /b?(*SKIP)c/
  7044. bc
  7045. 0: bc
  7046. abc
  7047. 0: bc
  7048. /(*SKIP)bc/
  7049. a
  7050. No match
  7051. /(*SKIP)b/
  7052. a
  7053. No match
  7054. /(?P<abn>(?P=abn)xxx|)+/
  7055. xxx
  7056. 0:
  7057. 1:
  7058. /(?i:([^b]))(?1)/
  7059. aa
  7060. 0: aa
  7061. 1: a
  7062. aA
  7063. 0: aA
  7064. 1: a
  7065. ** Failers
  7066. 0: **
  7067. 1: *
  7068. ab
  7069. No match
  7070. aB
  7071. No match
  7072. Ba
  7073. No match
  7074. ba
  7075. No match
  7076. /^(?&t)*+(?(DEFINE)(?<t>a))\w$/
  7077. aaaaaaX
  7078. 0: aaaaaaX
  7079. ** Failers
  7080. No match
  7081. aaaaaa
  7082. No match
  7083. /^(?&t)*(?(DEFINE)(?<t>a))\w$/
  7084. aaaaaaX
  7085. 0: aaaaaaX
  7086. aaaaaa
  7087. 0: aaaaaa
  7088. /^(a)*+(\w)/
  7089. aaaaX
  7090. 0: aaaaX
  7091. 1: a
  7092. 2: X
  7093. YZ
  7094. 0: Y
  7095. 1: <unset>
  7096. 2: Y
  7097. ** Failers
  7098. No match
  7099. aaaa
  7100. No match
  7101. /^(?:a)*+(\w)/
  7102. aaaaX
  7103. 0: aaaaX
  7104. 1: X
  7105. YZ
  7106. 0: Y
  7107. 1: Y
  7108. ** Failers
  7109. No match
  7110. aaaa
  7111. No match
  7112. /^(a)++(\w)/
  7113. aaaaX
  7114. 0: aaaaX
  7115. 1: a
  7116. 2: X
  7117. ** Failers
  7118. No match
  7119. aaaa
  7120. No match
  7121. YZ
  7122. No match
  7123. /^(?:a)++(\w)/
  7124. aaaaX
  7125. 0: aaaaX
  7126. 1: X
  7127. ** Failers
  7128. No match
  7129. aaaa
  7130. No match
  7131. YZ
  7132. No match
  7133. /^(a)?+(\w)/
  7134. aaaaX
  7135. 0: aa
  7136. 1: a
  7137. 2: a
  7138. YZ
  7139. 0: Y
  7140. 1: <unset>
  7141. 2: Y
  7142. /^(?:a)?+(\w)/
  7143. aaaaX
  7144. 0: aa
  7145. 1: a
  7146. YZ
  7147. 0: Y
  7148. 1: Y
  7149. /^(a){2,}+(\w)/
  7150. aaaaX
  7151. 0: aaaaX
  7152. 1: a
  7153. 2: X
  7154. ** Failers
  7155. No match
  7156. aaa
  7157. No match
  7158. YZ
  7159. No match
  7160. /^(?:a){2,}+(\w)/
  7161. aaaaX
  7162. 0: aaaaX
  7163. 1: X
  7164. ** Failers
  7165. No match
  7166. aaa
  7167. No match
  7168. YZ
  7169. No match
  7170. /(a|)*(?1)b/
  7171. b
  7172. 0: b
  7173. 1:
  7174. ab
  7175. 0: ab
  7176. 1:
  7177. aab
  7178. 0: aab
  7179. 1:
  7180. /(a)++(?1)b/
  7181. ** Failers
  7182. No match
  7183. ab
  7184. No match
  7185. aab
  7186. No match
  7187. /(a)*+(?1)b/
  7188. ** Failers
  7189. No match
  7190. ab
  7191. No match
  7192. aab
  7193. No match
  7194. /(?1)(?:(b)){0}/
  7195. b
  7196. 0: b
  7197. /(foo ( \( ((?:(?> [^()]+ )|(?2))*) \) ) )/x
  7198. foo(bar(baz)+baz(bop))
  7199. 0: foo(bar(baz)+baz(bop))
  7200. 1: foo(bar(baz)+baz(bop))
  7201. 2: (bar(baz)+baz(bop))
  7202. 3: bar(baz)+baz(bop)
  7203. /(A (A|B(*ACCEPT)|C) D)(E)/x
  7204. AB
  7205. 0: AB
  7206. 1: AB
  7207. 2: B
  7208. /\A.*?(a|bc)/
  7209. ba
  7210. 0: ba
  7211. 1: a
  7212. /\A.*?(?:a|bc)++/
  7213. ba
  7214. 0: ba
  7215. /\A.*?(a|bc)++/
  7216. ba
  7217. 0: ba
  7218. 1: a
  7219. /\A.*?(?:a|bc|d)/
  7220. ba
  7221. 0: ba
  7222. /(?:(b))++/
  7223. beetle
  7224. 0: b
  7225. 1: b
  7226. /(?(?=(a(*ACCEPT)z))a)/
  7227. a
  7228. 0: a
  7229. 1: a
  7230. /^(a)(?1)+ab/
  7231. aaaab
  7232. 0: aaaab
  7233. 1: a
  7234. /^(a)(?1)++ab/
  7235. aaaab
  7236. No match
  7237. /^(?=a(*:M))aZ/K
  7238. aZbc
  7239. 0: aZ
  7240. MK: M
  7241. /^(?!(*:M)b)aZ/K
  7242. aZbc
  7243. 0: aZ
  7244. /(?(DEFINE)(a))?b(?1)/
  7245. backgammon
  7246. 0: ba
  7247. /^\N+/
  7248. abc\ndef
  7249. 0: abc
  7250. /^\N{1,}/
  7251. abc\ndef
  7252. 0: abc
  7253. /(?(R)a+|(?R)b)/
  7254. aaaabcde
  7255. 0: aaaab
  7256. /(?(R)a+|((?R))b)/
  7257. aaaabcde
  7258. 0: aaaab
  7259. 1: aaaa
  7260. /((?(R)a+|(?1)b))/
  7261. aaaabcde
  7262. 0: aaaab
  7263. 1: aaaab
  7264. /((?(R1)a+|(?1)b))/
  7265. aaaabcde
  7266. 0: aaaab
  7267. 1: aaaab
  7268. /((?(R)a|(?1)))*/
  7269. aaa
  7270. 0: aaa
  7271. 1: a
  7272. /((?(R)a|(?1)))+/
  7273. aaa
  7274. 0: aaa
  7275. 1: a
  7276. /a(*:any
  7277. name)/K
  7278. abc
  7279. 0: a
  7280. MK: any \x0aname
  7281. /(?>(?&t)c|(?&t))(?(DEFINE)(?<t>a|b(*PRUNE)c))/
  7282. a
  7283. 0: a
  7284. ba
  7285. 0: a
  7286. bba
  7287. 0: a
  7288. /--- Checking revised (*THEN) handling ---/
  7289. /--- Capture ---/
  7290. /^.*? (a(*THEN)b) c/x
  7291. aabc
  7292. No match
  7293. /^.*? (a(*THEN)b|(*F)) c/x
  7294. aabc
  7295. 0: aabc
  7296. 1: ab
  7297. /^.*? ( (a(*THEN)b) | (*F) ) c/x
  7298. aabc
  7299. 0: aabc
  7300. 1: ab
  7301. 2: ab
  7302. /^.*? ( (a(*THEN)b) ) c/x
  7303. aabc
  7304. No match
  7305. /--- Non-capture ---/
  7306. /^.*? (?:a(*THEN)b) c/x
  7307. aabc
  7308. No match
  7309. /^.*? (?:a(*THEN)b|(*F)) c/x
  7310. aabc
  7311. 0: aabc
  7312. /^.*? (?: (?:a(*THEN)b) | (*F) ) c/x
  7313. aabc
  7314. 0: aabc
  7315. /^.*? (?: (?:a(*THEN)b) ) c/x
  7316. aabc
  7317. No match
  7318. /--- Atomic ---/
  7319. /^.*? (?>a(*THEN)b) c/x
  7320. aabc
  7321. No match
  7322. /^.*? (?>a(*THEN)b|(*F)) c/x
  7323. aabc
  7324. 0: aabc
  7325. /^.*? (?> (?>a(*THEN)b) | (*F) ) c/x
  7326. aabc
  7327. 0: aabc
  7328. /^.*? (?> (?>a(*THEN)b) ) c/x
  7329. aabc
  7330. No match
  7331. /--- Possessive capture ---/
  7332. /^.*? (a(*THEN)b)++ c/x
  7333. aabc
  7334. No match
  7335. /^.*? (a(*THEN)b|(*F))++ c/x
  7336. aabc
  7337. 0: aabc
  7338. 1: ab
  7339. /^.*? ( (a(*THEN)b)++ | (*F) )++ c/x
  7340. aabc
  7341. 0: aabc
  7342. 1: ab
  7343. 2: ab
  7344. /^.*? ( (a(*THEN)b)++ )++ c/x
  7345. aabc
  7346. No match
  7347. /--- Possessive non-capture ---/
  7348. /^.*? (?:a(*THEN)b)++ c/x
  7349. aabc
  7350. No match
  7351. /^.*? (?:a(*THEN)b|(*F))++ c/x
  7352. aabc
  7353. 0: aabc
  7354. /^.*? (?: (?:a(*THEN)b)++ | (*F) )++ c/x
  7355. aabc
  7356. 0: aabc
  7357. /^.*? (?: (?:a(*THEN)b)++ )++ c/x
  7358. aabc
  7359. No match
  7360. /--- Condition assertion ---/
  7361. /^(?(?=a(*THEN)b)ab|ac)/
  7362. ac
  7363. 0: ac
  7364. /--- Condition ---/
  7365. /^.*?(?(?=a)a|b(*THEN)c)/
  7366. ba
  7367. No match
  7368. /^.*?(?:(?(?=a)a|b(*THEN)c)|d)/
  7369. ba
  7370. 0: ba
  7371. /^.*?(?(?=a)a(*THEN)b|c)/
  7372. ac
  7373. No match
  7374. /--- Assertion ---/
  7375. /^.*(?=a(*THEN)b)/
  7376. aabc
  7377. 0: a
  7378. /------------------------------/
  7379. /(?>a(*:m))/imsxSK
  7380. a
  7381. 0: a
  7382. MK: m
  7383. /(?>(a)(*:m))/imsxSK
  7384. a
  7385. 0: a
  7386. 1: a
  7387. MK: m
  7388. /(?<=a(*ACCEPT)b)c/
  7389. xacd
  7390. 0: c
  7391. /(?<=(a(*ACCEPT)b))c/
  7392. xacd
  7393. 0: c
  7394. 1: a
  7395. /(?<=(a(*COMMIT)b))c/
  7396. xabcd
  7397. 0: c
  7398. 1: ab
  7399. ** Failers
  7400. No match
  7401. xacd
  7402. No match
  7403. /(?<!a(*FAIL)b)c/
  7404. xcd
  7405. 0: c
  7406. acd
  7407. 0: c
  7408. /(?<=a(*:N)b)c/K
  7409. xabcd
  7410. 0: c
  7411. MK: N
  7412. /(?<=a(*PRUNE)b)c/
  7413. xabcd
  7414. 0: c
  7415. /(?<=a(*SKIP)b)c/
  7416. xabcd
  7417. 0: c
  7418. /(?<=a(*THEN)b)c/
  7419. xabcd
  7420. 0: c
  7421. /(a)(?2){2}(.)/
  7422. abcd
  7423. 0: abcd
  7424. 1: a
  7425. 2: d
  7426. /(*MARK:A)(*PRUNE:B)(C|X)/KS
  7427. C
  7428. 0: C
  7429. 1: C
  7430. MK: B
  7431. D
  7432. No match, mark = B
  7433. /(*MARK:A)(*PRUNE:B)(C|X)/KSS
  7434. C
  7435. 0: C
  7436. 1: C
  7437. MK: B
  7438. D
  7439. No match, mark = B
  7440. /(*MARK:A)(*THEN:B)(C|X)/KS
  7441. C
  7442. 0: C
  7443. 1: C
  7444. MK: B
  7445. D
  7446. No match, mark = B
  7447. /(*MARK:A)(*THEN:B)(C|X)/KSY
  7448. C
  7449. 0: C
  7450. 1: C
  7451. MK: B
  7452. D
  7453. No match, mark = B
  7454. /(*MARK:A)(*THEN:B)(C|X)/KSS
  7455. C
  7456. 0: C
  7457. 1: C
  7458. MK: B
  7459. D
  7460. No match, mark = B
  7461. /--- This should fail, as the skip causes a bump to offset 3 (the skip) ---/
  7462. /A(*MARK:A)A+(*SKIP)(B|Z) | AC/xK
  7463. AAAC
  7464. No match, mark = A
  7465. /--- Same --/
  7466. /A(*MARK:A)A+(*MARK:B)(*SKIP:B)(B|Z) | AC/xK
  7467. AAAC
  7468. No match, mark = B
  7469. /A(*:A)A+(*SKIP)(B|Z) | AC/xK
  7470. AAAC
  7471. No match, mark = A
  7472. /--- This should fail, as a null name is the same as no name ---/
  7473. /A(*MARK:A)A+(*SKIP:)(B|Z) | AC/xK
  7474. AAAC
  7475. No match, mark = A
  7476. /--- A check on what happens after hitting a mark and them bumping along to
  7477. something that does not even start. Perl reports tags after the failures here,
  7478. though it does not when the individual letters are made into something
  7479. more complicated. ---/
  7480. /A(*:A)B|XX(*:B)Y/K
  7481. AABC
  7482. 0: AB
  7483. MK: A
  7484. XXYZ
  7485. 0: XXY
  7486. MK: B
  7487. ** Failers
  7488. No match
  7489. XAQQ
  7490. No match, mark = A
  7491. XAQQXZZ
  7492. No match, mark = A
  7493. AXQQQ
  7494. No match, mark = A
  7495. AXXQQQ
  7496. No match, mark = B
  7497. /^(A(*THEN:A)B|C(*THEN:B)D)/K
  7498. AB
  7499. 0: AB
  7500. 1: AB
  7501. MK: A
  7502. CD
  7503. 0: CD
  7504. 1: CD
  7505. MK: B
  7506. ** Failers
  7507. No match
  7508. AC
  7509. No match, mark = A
  7510. CB
  7511. No match, mark = B
  7512. /^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K
  7513. AB
  7514. 0: AB
  7515. 1: AB
  7516. MK: A
  7517. CD
  7518. 0: CD
  7519. 1: CD
  7520. MK: B
  7521. ** Failers
  7522. No match
  7523. AC
  7524. No match, mark = A
  7525. CB
  7526. No match, mark = B
  7527. /--- An empty name does not pass back an empty string. It is the same as if no
  7528. name were given. ---/
  7529. /^(A(*PRUNE:)B|C(*PRUNE:B)D)/K
  7530. AB
  7531. 0: AB
  7532. 1: AB
  7533. CD
  7534. 0: CD
  7535. 1: CD
  7536. MK: B
  7537. /--- PRUNE goes to next bumpalong; COMMIT does not. ---/
  7538. /A(*PRUNE:A)B/K
  7539. ACAB
  7540. 0: AB
  7541. MK: A
  7542. /--- Mark names can be duplicated ---/
  7543. /A(*:A)B|X(*:A)Y/K
  7544. AABC
  7545. 0: AB
  7546. MK: A
  7547. XXYZ
  7548. 0: XY
  7549. MK: A
  7550. /b(*:m)f|a(*:n)w/K
  7551. aw
  7552. 0: aw
  7553. MK: n
  7554. ** Failers
  7555. No match, mark = n
  7556. abc
  7557. No match, mark = m
  7558. /b(*:m)f|aw/K
  7559. abaw
  7560. 0: aw
  7561. ** Failers
  7562. No match
  7563. abc
  7564. No match, mark = m
  7565. abax
  7566. No match, mark = m
  7567. /A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/xK
  7568. AAAC
  7569. 0: AAC
  7570. /a(*PRUNE:X)bc|qq/KY
  7571. ** Failers
  7572. No match, mark = X
  7573. axy
  7574. No match, mark = X
  7575. /a(*THEN:X)bc|qq/KY
  7576. ** Failers
  7577. No match, mark = X
  7578. axy
  7579. No match, mark = X
  7580. /(?=a(*MARK:A)b)..x/K
  7581. abxy
  7582. 0: abx
  7583. MK: A
  7584. ** Failers
  7585. No match
  7586. abpq
  7587. No match
  7588. /(?=a(*MARK:A)b)..(*:Y)x/K
  7589. abxy
  7590. 0: abx
  7591. MK: Y
  7592. ** Failers
  7593. No match
  7594. abpq
  7595. No match
  7596. /(?=a(*PRUNE:A)b)..x/K
  7597. abxy
  7598. 0: abx
  7599. MK: A
  7600. ** Failers
  7601. No match
  7602. abpq
  7603. No match
  7604. /(?=a(*PRUNE:A)b)..(*:Y)x/K
  7605. abxy
  7606. 0: abx
  7607. MK: Y
  7608. ** Failers
  7609. No match
  7610. abpq
  7611. No match
  7612. /(?=a(*THEN:A)b)..x/K
  7613. abxy
  7614. 0: abx
  7615. MK: A
  7616. ** Failers
  7617. No match
  7618. abpq
  7619. No match
  7620. /(?=a(*THEN:A)b)..(*:Y)x/K
  7621. abxy
  7622. 0: abx
  7623. MK: Y
  7624. ** Failers
  7625. No match
  7626. abpq
  7627. No match
  7628. /(another)?(\1?)test/
  7629. hello world test
  7630. 0: test
  7631. 1: <unset>
  7632. 2:
  7633. /(another)?(\1+)test/
  7634. hello world test
  7635. No match
  7636. /(a(*COMMIT)b){0}a(?1)|aac/
  7637. aac
  7638. 0: aac
  7639. /((?:a?)*)*c/
  7640. aac
  7641. 0: aac
  7642. 1:
  7643. /((?>a?)*)*c/
  7644. aac
  7645. 0: aac
  7646. 1:
  7647. /(?>.*?a)(?<=ba)/
  7648. aba
  7649. 0: ba
  7650. /(?:.*?a)(?<=ba)/
  7651. aba
  7652. 0: aba
  7653. /.*?a(*PRUNE)b/
  7654. aab
  7655. 0: ab
  7656. /.*?a(*PRUNE)b/s
  7657. aab
  7658. 0: ab
  7659. /^a(*PRUNE)b/s
  7660. aab
  7661. No match
  7662. /.*?a(*SKIP)b/
  7663. aab
  7664. 0: ab
  7665. /(?>.*?a)b/s
  7666. aab
  7667. 0: ab
  7668. /(?>.*?a)b/
  7669. aab
  7670. 0: ab
  7671. /(?>^a)b/s
  7672. aab
  7673. No match
  7674. /(?>.*?)(?<=(abcd)|(wxyz))/
  7675. alphabetabcd
  7676. 0:
  7677. 1: abcd
  7678. endingwxyz
  7679. 0:
  7680. 1: <unset>
  7681. 2: wxyz
  7682. /(?>.*)(?<=(abcd)|(wxyz))/
  7683. alphabetabcd
  7684. 0: alphabetabcd
  7685. 1: abcd
  7686. endingwxyz
  7687. 0: endingwxyz
  7688. 1: <unset>
  7689. 2: wxyz
  7690. "(?>.*)foo"
  7691. abcdfooxyz
  7692. No match
  7693. "(?>.*?)foo"
  7694. abcdfooxyz
  7695. 0: foo
  7696. /(?:(a(*PRUNE)b)){0}(?:(?1)|ac)/
  7697. ac
  7698. 0: ac
  7699. /(?:(a(*SKIP)b)){0}(?:(?1)|ac)/
  7700. ac
  7701. 0: ac
  7702. /(?<=(*SKIP)ac)a/
  7703. aa
  7704. No match
  7705. /A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK
  7706. AAAC
  7707. 0: AC
  7708. /a(*SKIP:m)x|ac(*:n)(*SKIP:n)d|ac/K
  7709. acacd
  7710. 0: acd
  7711. MK: n
  7712. /A(*SKIP:m)x|A(*SKIP:n)x|AB/K
  7713. AB
  7714. 0: AB
  7715. /((*SKIP:r)d){0}a(*SKIP:m)x|ac(*:n)|ac/K
  7716. acacd
  7717. 0: ac
  7718. MK: n
  7719. /-- Tests that try to figure out how Perl works. My hypothesis is that the
  7720. first verb that is backtracked onto is the one that acts. This seems to be
  7721. the case almost all the time, but there is one exception that is perhaps a
  7722. bug. --/
  7723. /-- This matches "aaaac"; each PRUNE advances one character until the subject
  7724. no longer starts with 5 'a's. --/
  7725. /aaaaa(*PRUNE)b|a+c/
  7726. aaaaaac
  7727. 0: aaaac
  7728. /-- Putting SKIP in front of PRUNE makes no difference, as it is never
  7729. backtracked onto, whether or not it has a label. --/
  7730. /aaaaa(*SKIP)(*PRUNE)b|a+c/
  7731. aaaaaac
  7732. 0: aaaac
  7733. /aaaaa(*SKIP:N)(*PRUNE)b|a+c/
  7734. aaaaaac
  7735. 0: aaaac
  7736. /aaaa(*:N)a(*SKIP:N)(*PRUNE)b|a+c/
  7737. aaaaaac
  7738. 0: aaaac
  7739. /-- Putting THEN in front makes no difference. */
  7740. /aaaaa(*THEN)(*PRUNE)b|a+c/
  7741. aaaaaac
  7742. 0: aaaac
  7743. /-- However, putting COMMIT in front of the prune changes it to "no match". I
  7744. think this is inconsistent and possibly a bug. For the moment, running this
  7745. test is moved out of the Perl-compatible file. --/
  7746. /aaaaa(*COMMIT)(*PRUNE)b|a+c/
  7747. /---- OK, lets play the same game again using SKIP instead of PRUNE. ----/
  7748. /-- This matches "ac" because SKIP forces the next match to start on the
  7749. sixth "a". --/
  7750. /aaaaa(*SKIP)b|a+c/
  7751. aaaaaac
  7752. 0: ac
  7753. /-- Putting PRUNE in front makes no difference. --/
  7754. /aaaaa(*PRUNE)(*SKIP)b|a+c/
  7755. aaaaaac
  7756. 0: ac
  7757. /-- Putting THEN in front makes no difference. --/
  7758. /aaaaa(*THEN)(*SKIP)b|a+c/
  7759. aaaaaac
  7760. 0: ac
  7761. /-- In this case, neither does COMMIT. This still matches "ac". --/
  7762. /aaaaa(*COMMIT)(*SKIP)b|a+c/
  7763. aaaaaac
  7764. 0: ac
  7765. /-- This gives "no match", as expected. --/
  7766. /aaaaa(*COMMIT)b|a+c/
  7767. aaaaaac
  7768. No match
  7769. /------ Tests using THEN ------/
  7770. /-- This matches "aaaaaac", as expected. --/
  7771. /aaaaa(*THEN)b|a+c/
  7772. aaaaaac
  7773. 0: aaaaaac
  7774. /-- Putting SKIP in front makes no difference. --/
  7775. /aaaaa(*SKIP)(*THEN)b|a+c/
  7776. aaaaaac
  7777. 0: aaaaaac
  7778. /-- Putting PRUNE in front makes no difference. --/
  7779. /aaaaa(*PRUNE)(*THEN)b|a+c/
  7780. aaaaaac
  7781. 0: aaaaaac
  7782. /-- Putting COMMIT in front makes no difference. --/
  7783. /aaaaa(*COMMIT)(*THEN)b|a+c/
  7784. aaaaaac
  7785. 0: aaaaaac
  7786. /-- End of "priority" tests --/
  7787. /aaaaa(*:m)(*PRUNE:m)(*SKIP:m)m|a+/
  7788. aaaaaa
  7789. 0: a
  7790. /aaaaa(*:m)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/
  7791. aaaaaa
  7792. 0: a
  7793. /aaaaa(*:n)(*PRUNE:m)(*SKIP:m)m|a+/
  7794. aaaaaa
  7795. 0: aaaa
  7796. /aaaaa(*:n)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/
  7797. aaaaaa
  7798. 0: a
  7799. /a(*MARK:A)aa(*PRUNE:A)a(*SKIP:A)b|a+c/
  7800. aaaac
  7801. 0: aac
  7802. /a(*MARK:A)aa(*MARK:A)a(*SKIP:A)b|a+c/
  7803. aaaac
  7804. 0: ac
  7805. /aaa(*PRUNE:A)a(*SKIP:A)b|a+c/
  7806. aaaac
  7807. 0: aac
  7808. /aaa(*MARK:A)a(*SKIP:A)b|a+c/
  7809. aaaac
  7810. 0: ac
  7811. /a(*:m)a(*COMMIT)(*SKIP:m)b|a+c/K
  7812. aaaaaac
  7813. 0: ac
  7814. /.?(a|b(*THEN)c)/
  7815. ba
  7816. 0: ba
  7817. 1: a
  7818. /(a(*COMMIT)b)c|abd/
  7819. abc
  7820. 0: abc
  7821. 1: ab
  7822. abd
  7823. No match
  7824. /(?=a(*COMMIT)b)abc|abd/
  7825. abc
  7826. 0: abc
  7827. abd
  7828. 0: abd
  7829. /(?>a(*COMMIT)b)c|abd/
  7830. abc
  7831. 0: abc
  7832. abd
  7833. 0: abd
  7834. /a(?=b(*COMMIT)c)[^d]|abd/
  7835. abd
  7836. No match
  7837. abc
  7838. 0: ab
  7839. /a(?=bc).|abd/
  7840. abd
  7841. 0: abd
  7842. abc
  7843. 0: ab
  7844. /a(?>b(*COMMIT)c)d|abd/
  7845. abceabd
  7846. No match
  7847. /a(?>bc)d|abd/
  7848. abceabd
  7849. 0: abd
  7850. /(?>a(*COMMIT)b)c|abd/
  7851. abd
  7852. 0: abd
  7853. /(?>a(*COMMIT)c)d|abd/
  7854. abd
  7855. No match
  7856. /((?=a(*COMMIT)b)ab|ac){0}(?:(?1)|a(c))/
  7857. ac
  7858. 0: ac
  7859. 1: <unset>
  7860. 2: c
  7861. /-- These tests were formerly in test 2, but changes in PCRE and Perl have
  7862. made them compatible. --/
  7863. /^(a)?(?(1)a|b)+$/
  7864. *** Failers
  7865. No match
  7866. a
  7867. No match
  7868. /(?=a\Kb)ab/
  7869. ab
  7870. 0: b
  7871. /(?!a\Kb)ac/
  7872. ac
  7873. 0: ac
  7874. /^abc(?<=b\Kc)d/
  7875. abcd
  7876. 0: cd
  7877. /^abc(?<!b\Kq)d/
  7878. abcd
  7879. 0: abcd
  7880. /A(*PRUNE:A)A+(*SKIP:A)(B|Z) | AC/xK
  7881. AAAC
  7882. No match, mark = A
  7883. /^((abc|abcx)(*THEN)y|abcd)/
  7884. abcd
  7885. 0: abcd
  7886. 1: abcd
  7887. *** Failers
  7888. No match
  7889. abcxy
  7890. No match
  7891. /^((yes|no)(*THEN)(*F))?/
  7892. yes
  7893. No match
  7894. /(A (.*) C? (*THEN) | A D) (*FAIL)/x
  7895. AbcdCBefgBhiBqz
  7896. No match
  7897. /(A (.*) C? (*THEN) | A D) z/x
  7898. AbcdCBefgBhiBqz
  7899. No match
  7900. /(A (.*) C? (*THEN) | A D) \s* (*FAIL)/x
  7901. AbcdCBefgBhiBqz
  7902. No match
  7903. /(A (.*) C? (*THEN) | A D) \s* z/x
  7904. AbcdCBefgBhiBqz
  7905. No match
  7906. /(A (.*) (?:C|) (*THEN) | A D) (*FAIL)/x
  7907. AbcdCBefgBhiBqz
  7908. No match
  7909. /(A (.*) (?:C|) (*THEN) | A D) z/x
  7910. AbcdCBefgBhiBqz
  7911. No match
  7912. /(A (.*) C{0,6} (*THEN) | A D) (*FAIL)/x
  7913. AbcdCBefgBhiBqz
  7914. No match
  7915. /(A (.*) C{0,6} (*THEN) | A D) z/x
  7916. AbcdCBefgBhiBqz
  7917. No match
  7918. /(A (.*) (CE){0,6} (*THEN) | A D) (*FAIL)/x
  7919. AbcdCEBefgBhiBqz
  7920. No match
  7921. /(A (.*) (CE){0,6} (*THEN) | A D) z/x
  7922. AbcdCEBefgBhiBqz
  7923. No match
  7924. /(A (.*) (CE*){0,6} (*THEN) | A D) (*FAIL)/x
  7925. AbcdCBefgBhiBqz
  7926. No match
  7927. /(A (.*) (CE*){0,6} (*THEN) | A D) z/x
  7928. AbcdCBefgBhiBqz
  7929. No match
  7930. /(?=a(*COMMIT)b|ac)ac|ac/
  7931. ac
  7932. No match
  7933. /(?=a(*COMMIT)b|(ac)) ac | (a)c/x
  7934. ac
  7935. No match
  7936. /--------/
  7937. /(?(?!b(*THEN)a)bn|bnn)/
  7938. bnn
  7939. 0: bn
  7940. /(?!b(*SKIP)a)bn|bnn/
  7941. bnn
  7942. 0: bn
  7943. /(?(?!b(*SKIP)a)bn|bnn)/
  7944. bnn
  7945. 0: bn
  7946. /(?!b(*PRUNE)a)bn|bnn/
  7947. bnn
  7948. 0: bn
  7949. /(?(?!b(*PRUNE)a)bn|bnn)/
  7950. bnn
  7951. 0: bn
  7952. /(?!b(*COMMIT)a)bn|bnn/
  7953. bnn
  7954. 0: bn
  7955. /(?(?!b(*COMMIT)a)bn|bnn)/
  7956. bnn
  7957. 0: bn
  7958. /(?=b(*SKIP)a)bn|bnn/
  7959. bnn
  7960. No match
  7961. /(?=b(*THEN)a)bn|bnn/
  7962. bnn
  7963. 0: bnn
  7964. /^(?!a(*SKIP)b)/
  7965. ac
  7966. 0:
  7967. /^(?!a(*SKIP)b)../
  7968. acd
  7969. 0: ac
  7970. /(?!a(*SKIP)b)../
  7971. acd
  7972. 0: ac
  7973. /^(?(?!a(*SKIP)b))/
  7974. ac
  7975. 0:
  7976. /^(?!a(*PRUNE)b)../
  7977. acd
  7978. 0: ac
  7979. /(?!a(*PRUNE)b)../
  7980. acd
  7981. 0: ac
  7982. /(?!a(*COMMIT)b)ac|cd/
  7983. ac
  7984. 0: ac
  7985. /\A.*?(?:a|bc)/
  7986. ba
  7987. 0: ba
  7988. /^(A(*THEN)B|C(*THEN)D)/
  7989. CD
  7990. 0: CD
  7991. 1: CD
  7992. /(*:m(m)(?&y)(?(DEFINE)(?<y>b))/K
  7993. abc
  7994. 0: b
  7995. MK: m(m
  7996. /(*PRUNE:m(m)(?&y)(?(DEFINE)(?<y>b))/K
  7997. abc
  7998. 0: b
  7999. MK: m(m
  8000. /(*SKIP:m(m)(?&y)(?(DEFINE)(?<y>b))/K
  8001. abc
  8002. 0: b
  8003. /(*THEN:m(m)(?&y)(?(DEFINE)(?<y>b))/K
  8004. abc
  8005. 0: b
  8006. MK: m(m
  8007. /^\d*\w{4}/
  8008. 1234
  8009. 0: 1234
  8010. 123
  8011. No match
  8012. /^[^b]*\w{4}/
  8013. aaaa
  8014. 0: aaaa
  8015. aaa
  8016. No match
  8017. /^[^b]*\w{4}/i
  8018. aaaa
  8019. 0: aaaa
  8020. aaa
  8021. No match
  8022. /^a*\w{4}/
  8023. aaaa
  8024. 0: aaaa
  8025. aaa
  8026. No match
  8027. /^a*\w{4}/i
  8028. aaaa
  8029. 0: aaaa
  8030. aaa
  8031. No match
  8032. /(?(?=ab)ab)/+
  8033. ca
  8034. 0:
  8035. 0+ ca
  8036. cd
  8037. 0:
  8038. 0+ cd
  8039. /(?:(?<n>foo)|(?<n>bar))\k<n>/J
  8040. foofoo
  8041. 0: foofoo
  8042. 1: foo
  8043. barbar
  8044. 0: barbar
  8045. 1: <unset>
  8046. 2: bar
  8047. /(?<n>A)(?:(?<n>foo)|(?<n>bar))\k<n>/J
  8048. AfooA
  8049. 0: AfooA
  8050. 1: A
  8051. 2: foo
  8052. AbarA
  8053. 0: AbarA
  8054. 1: A
  8055. 2: <unset>
  8056. 3: bar
  8057. ** Failers
  8058. No match
  8059. Afoofoo
  8060. No match
  8061. Abarbar
  8062. No match
  8063. /^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
  8064. 1 IN SOA non-sp1 non-sp2(
  8065. 0: 1 IN SOA non-sp1 non-sp2(
  8066. 1: 1
  8067. 2: non-sp1
  8068. 3: non-sp2
  8069. /^ (?:(?<A>A)|(?'B'B)(?<A>A)) (?('A')x) (?(<B>)y)$/xJ
  8070. Ax
  8071. 0: Ax
  8072. 1: A
  8073. BAxy
  8074. 0: BAxy
  8075. 1: <unset>
  8076. 2: B
  8077. 3: A
  8078. /^A\xZ/
  8079. A\0Z
  8080. 0: A\x00Z
  8081. /^A\o{123}B/
  8082. A\123B
  8083. 0: ASB
  8084. / ^ a + + b $ /x
  8085. aaaab
  8086. 0: aaaab
  8087. / ^ a + #comment
  8088. + b $ /x
  8089. aaaab
  8090. 0: aaaab
  8091. / ^ a + #comment
  8092. #comment
  8093. + b $ /x
  8094. aaaab
  8095. 0: aaaab
  8096. / ^ (?> a + ) b $ /x
  8097. aaaab
  8098. 0: aaaab
  8099. / ^ ( a + ) + + \w $ /x
  8100. aaaab
  8101. 0: aaaab
  8102. 1: aaaa
  8103. /(?:a\Kb)*+/+
  8104. ababc
  8105. 0: b
  8106. 0+ c
  8107. /(?>a\Kb)*/+
  8108. ababc
  8109. 0: b
  8110. 0+ c
  8111. /(?:a\Kb)*/+
  8112. ababc
  8113. 0: b
  8114. 0+ c
  8115. /(a\Kb)*+/+
  8116. ababc
  8117. 0: b
  8118. 0+ c
  8119. 1: ab
  8120. /(a\Kb)*/+
  8121. ababc
  8122. 0: b
  8123. 0+ c
  8124. 1: ab
  8125. /(?:x|(?:(xx|yy)+|x|x|x|x|x)|a|a|a)bc/
  8126. acb
  8127. No match
  8128. '\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++'
  8129. NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
  8130. 0: NON QUOTED "QUOT""ED" AFTER
  8131. '\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++'
  8132. NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
  8133. 0: NON QUOTED "QUOT""ED" AFTER
  8134. '\A(?:[^\"]++|\"(?:[^\"]++|\"\")++\")++'
  8135. NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
  8136. 0: NON QUOTED "QUOT""ED" AFTER
  8137. '\A([^\"1]++|[\"2]([^\"3]*+|[\"4][\"5])*+[\"6])++'
  8138. NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
  8139. 0: NON QUOTED "QUOT""ED" AFTER
  8140. 1: AFTER
  8141. 2:
  8142. /^\w+(?>\s*)(?<=\w)/
  8143. test test
  8144. 0: tes
  8145. /(?P<same>a)(?P<same>b)/gJ
  8146. abbaba
  8147. 0: ab
  8148. 1: a
  8149. 2: b
  8150. 0: ab
  8151. 1: a
  8152. 2: b
  8153. /(?P<same>a)(?P<same>b)(?P=same)/gJ
  8154. abbaba
  8155. 0: aba
  8156. 1: a
  8157. 2: b
  8158. /(?P=same)?(?P<same>a)(?P<same>b)/gJ
  8159. abbaba
  8160. 0: ab
  8161. 1: a
  8162. 2: b
  8163. 0: ab
  8164. 1: a
  8165. 2: b
  8166. /(?:(?P=same)?(?:(?P<same>a)|(?P<same>b))(?P=same))+/gJ
  8167. bbbaaabaabb
  8168. 0: bbbaaaba
  8169. 1: a
  8170. 2: b
  8171. 0: bb
  8172. 1: <unset>
  8173. 2: b
  8174. /(?:(?P=same)?(?:(?P=same)(?P<same>a)(?P=same)|(?P=same)?(?P<same>b)(?P=same)){2}(?P=same)(?P<same>c)(?P=same)){2}(?P<same>z)?/gJ
  8175. bbbaaaccccaaabbbcc
  8176. No match
  8177. /(?P<Name>a)?(?P<Name2>b)?(?(<Name>)c|d)*l/
  8178. acl
  8179. 0: acl
  8180. 1: a
  8181. bdl
  8182. 0: bdl
  8183. 1: <unset>
  8184. 2: b
  8185. adl
  8186. 0: dl
  8187. bcl
  8188. 0: l
  8189. /\sabc/
  8190. \x{0b}abc
  8191. 0: \x0babc
  8192. /[\Qa]\E]+/
  8193. aa]]
  8194. 0: aa]]
  8195. /[\Q]a\E]+/
  8196. aa]]
  8197. 0: aa]]
  8198. /(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/
  8199. 1234abcd
  8200. 0:
  8201. 1: <unset>
  8202. 2: <unset>
  8203. 3: <unset>
  8204. 4: <unset>
  8205. 5:
  8206. /(\2)(\1)/
  8207. "Z*(|d*){216}"
  8208. "(?1)(?#?'){8}(a)"
  8209. baaaaaaaaac
  8210. 0: aaaaaaaaa
  8211. 1: a
  8212. "(?|(\k'Pm')|(?'Pm'))"
  8213. abcd
  8214. 0:
  8215. 1:
  8216. /(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[,;:])(?=.{8,16})(?!.*[\s])/
  8217. \ Fred:099
  8218. 0:
  8219. /(?=.*X)X$/
  8220. \ X
  8221. 0: X
  8222. /X+(?#comment)?/
  8223. >XXX<
  8224. 0: X
  8225. / (?<word> \w+ )* \. /xi
  8226. pokus.
  8227. 0: pokus.
  8228. 1: pokus
  8229. /(?(DEFINE) (?<word> \w+ ) ) (?&word)* \./xi
  8230. pokus.
  8231. 0: pokus.
  8232. /(?(DEFINE) (?<word> \w+ ) ) ( (?&word)* ) \./xi
  8233. pokus.
  8234. 0: pokus.
  8235. 1: <unset>
  8236. 2: pokus
  8237. /(?&word)* (?(DEFINE) (?<word> \w+ ) ) \./xi
  8238. pokus.
  8239. 0: pokus.
  8240. /(?&word)* \. (?<word> \w+ )/xi
  8241. pokus.hokus
  8242. 0: pokus.hokus
  8243. 1: hokus
  8244. /-- End of testinput1 --/