!d@{0!@ @H9@@@4@T@@4@@x@0= а@!p@Aа@а@@@Pа@@@f8:@@p@أ@أ@RS)TUVWȯ@ȯ@`@34P@@)@C7@@DEX@FGHI.J@@H@H@@H@,X@@X@X@@5H@8@@(@@Ȭ@x@`@H@@mpeVersion8ef'[[:alpha:]][[:alnum:]_]*80regex.regfree0(@(((  09@9@:@0:@00regex.regexec0(@5@(((  0:@:@:@;@00regex.regerror0(@(((  0P;@;@;@;@00regex.regcomp0(@(((  0  RSTUVWregc0NameDef9@ @  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}X 0 <@P<@x<@<@0mentoken m0text5reetregcom(s1@pat15@06e1 @'*** END ***'5 @'==========='29 @assert V99rR9 @@r' ('' ([^ ]{3}) ''1) showall text'@  @ '"',text,'"'9d @@' Show all 3 letter words in this text:' 7@0в@texttext,' to live in.'L_91Z0X(@texttext,' and show they too can make',CR,'the world a better place'c(XX @text'Now is the time for all good men to',CR,'learn more about APL'5XHд@'** we can show all the matches in CR delimited text.''H(e@''$@ @assert V78rord @@@r' (quotedstring''XXX'') rxrplc s1'rse@P's1: ',s1' name=''??'', surname=''abcd'', age=18, etc.'P@@'** we can replace a pattern with a string:'8 @f@''$@  @assert V75r'3 @x@r' ''[\.\?!] *([a-z])'' rxmatches e1'@Hn@'e1: ',e1'blah b;ah. b;ah blah? Blah blah! blah! Ah!'H@P@' lowercase letter after a dot, ? or !:'_87@P@'** find all lowercase letters starting a sentence, that is, a'Pf@''$@X@'The other planes were from simplestrings and are padded with 0s.'or.XP&@'in it, the result contains at least 2 rows in each plane.''PXb@'NOTE: because the quotedstring was found and has a subexpression'_85X p @assert V72r'0 0@r' token rxmatches s1'0 @'s1: ',s1L_''6 8{@'** find all the values in ''s1'''8`@s1'age = 42 name= ''somkinda'''' djo'' email =jo@blahblaha.bla alias=x''Q89_`g@''$@P&@'(a token, here, is either a simplestring or a quotedstring)'P@@'token: ',tokenquotedstring,'|',simplestring95@HHq@' OR a char not a quote) followed by a final quote)',CRHXd@'(A quoted string is a quote followed by a series of (double quotes'95XH8@'quotedstring: ',quotedstring'''(''''|[^''])*''''4 v(HP(@'simplestring: ',t,' any char not a space or quote',CRabc'''P00@tsimplestring'[^ '']+'8),EQQ00@'** here are more patterns:',CR0g@''$@Xx@r' pat1 rxmatches ''first one, then another, then the last.'''oX81@'** This function finds ALL matches:'8@@''$@ x@assert V69r'47 H09@r' pat1 rxmatch ''first one, then another.'''''HX @'** returns the whole match and the subexpression (word):'XXi@''$@83@'pat1: ',rpat1'(',Word,')[[:punct:]]'80@'Word: ',rWord'[[:alpha:]]+'0X@'** here are the patterns for a word and word followed by punctuation:'Xk@''$@ @assert V63r'16 @@@r' NameDef showfirst ''3+dsa_7-31''''@ @assert V60r'7 @@r' NameDef showfirst ''3+dsa7'''R985 @@@' NameDef''[[:alpha:]][[:alnum:]_]*''']@Px@'** Here''s an example of pattern to recognise an Identifier:'cPl@''$@ `@assert V66r'84 Xb@r' ''ab{4,6}c'' showfirst ''abbbbbbbc(7bs) abbbbbc (5) abc''' XX|@'** the number of times a character must be repeated can be specified'X o@''$@ 8@assert V54r'53 Xd@r' ''a(b[aeiou])c\1'' showfirst ''not abecbi but abecbe...'''lX@0@'after "a" must also be found after "c" (\1)'@X(n@'** patterns may be repeated. Here whatever subexpression found'' L(X`@''$@ @assert V51r'22 Xؿ@r' ''(wee|week)(knights|nights)'' rxmatch ''weeknights'''.';]]X @assert V57r'9 H;@r' ''ab*c'' showfirst ''abbbbbbc abbcabc''''1H(@'** first match wins'r((x@''$@ h@assert V48r'6 H`<@r' ''a(b[aeiou])c'' showfirst ''x abec x'''*'''H @assert V45r'3 H`>@r' ''a(b[aeiou])c'' rxmatch ''x abec x'''a'''H @assert V42r'0 @0@r' ''((a*)a)a''rxmatch ''zzaaaa'''e1 '@PP@' the location of the whole pattern and each subexpression:'PX@'** subexpressions are specified with parentheses. returns'Xh@''%@ @assert V39r'7 h@r' ''ab[^[:digit:]]c'' showfirst ''doesnt matches ab4c but matches ab$c!!!'''deh0@'** exclusion is made with ^:'00@''$@ @assert V36r'4/ pj@r' ''ab[[:space:]][[:alpha:]]c'' showfirst ''alpha or spaces matches ab zc!!!'''p(p@'** 2 separate sets:'r((@''(%@ @assert V33r'1y hh@r' ''ab[[:space:][:alpha:]]c'' showfirst ''alpha or spaces matches ab c!!!''' h(@'** a set of 2 sets:'r(@''$@ (@assert V30r'8 Xp@r' ''ab[a-z]c'' showfirst ''not with ab3c but OK with abzc!'''X X@assert V27r'5 Xn@r' ''ab[0-9a-z]c'' showfirst ''same with ab3c now and abzc!'''X@@'** sets may also be specified as ranges'gfree@p@''φC@ @assert V24r'2 `W@r' ''ab[aeiou[:digit:]]c'' showfirst ''with ab3c now and abzc!''''''89_`HA@'** predefined sets like [:digits:] can be used'ges'Q1(H(@''$@ 8@assert V21r'xt @@'** sets may be specified within [brackets]'@n@''Ϭ&@ (@assert V18r' Xx"@r' ''ab\.c'' showfirst ''wont work on ab#c but works on ab.c'''XHC@'** \ escapes following character; "\." means "."'ets]'Hb@'';$@  @assert V15r'&@ X@y@r' ''ab?.c'' showfirst e1 "a", 0 or 1 "b", any char then "c"'XP*@'** ? means 0 or 1, + means 1 or more, * means 0 or more'd'P@'';#@ #@assert V12r 8@r' ''ab.c'' showfirst e1 'e8@'';#@0x@'======================'!00P@'** Series of examples:'0@;#@Xx$@ showfirst rxmatch rxmatches rxrplc showall lx OSSPATMATCH ClassesX8@;#@8x@;regcomp regexec regerror regfree8@;#@@@ example and test for regular expressions@8@@example;e1;pat1;r;s1;t;text;tokenons8hY@<@ =@=@@Y@(Y@(c@X@@b@X@X@hX@ 8X@ X@ W@ g@ W@W@W@0W@V@V@V@XV@V@U@U@U@~@hU@PU@U@T@T@pT@ 0T@!S@"S@#`S@$@S@%(S@&S@'R@(xR@)`R@*8R@+Q@,Q@-Q@.`Q@/P@0P@1P@2hP@3P@4O@5O@6pO@7PO@8O@9N@:N@;N@<`N@=@N@>M@?M@@M@AXM@BM@CL@DL@EL@F0L@GK@HK@IK@JPK@KK@LJ@MJ@NpJ@OPJ@P8J@QI@RI@SxI@T`I@UI@VH@WH@XH@YPH@ZG@[G@\G@]G@^0G@_F@`F@aHF@bF@cE@dE@e@E@fE@gD@hD@iD@j@D@kC@lC@mC@n0C@oB@pB@qhB@rHB@s0B@tA@uA@v`A@w@A@x(A@y@@z@@{0@@|@@}?@}?@~`?@@?@ ?@?@h te quotedstring h@ defineRX"."' 8en t" ,-6 M/O9X8exampleo aHd  be ive in.'H@f@0 @ Define all RX functionss:'''@0( '(''|[^'])*'(0p@ e signal 11 DYW SAX V18r00@ erz the error message15r0X@ rregerror codeCz255 we expect no more than a 255 chars msgng<3@X B@err: z255' 'e o@ 0C3@8@f:zregfree ,@8h@`b@b@b@g@ k@Xg@ g@f@f@f@@f@ f@ Hv@ e@ j@ e@ e@ he@8e@e@d@d@pd@Xd@8d@c@c@c@rxmatch8 $ ,-6 M0./79p@8 P@@ r0 2io0 `@   #$%&'(Xo@0@`0`@ This fn is io independent.YZ0@MaxSub0 !# 00@ e signal 11 DYW SAXL_8900@ @ erz the error message 0X8@ rregerror codeCz255 we expect no more than a 255 chars msgde;NX @ err:z256' ' {@;@h*@ 0;@Hv@ :EndIf ؖ@ r>all  @ :If 00 1/patrep2@s2@((q@ pat,>1 0/patrep (8x@ Replace patterns by constant in strE@8(Ў@ MaxSub1++/'('=pattern( @y@(u@u@hu@8w@w@v@v@v@hv@y@8 " =-?@ABCDERav[8rxrplc@ngC`@  !"#0)@'lookfor`8@r patrep rxrplc str;pat;rep;pos;new8si0@(iX@o ishow`h@hits(lchsdtring) b@0@max0@ r>,>/new merge all cellsYZ0 @ r>>/max١>r P@ max<ӯ>ҡ>rt (@ merge all lines8@88@(@;8@(@ r(<0 1)ա>d/r$@88@((@ d>'^'š>b cut show(0@ rb cut string,[.1]show)/' '0 (@ b1string=CR 8@ cut each line and keep those to show8@;4%@ @ show[i]'^'how @ i>i SAXow @X@ ihits[;0]+>ɡ>hits[;1] indices of hits@(p@ show(string)/' '8@( @ outline"@its @;8@0@ ifx(2,b)(b'rb cut x'),bd0 @@ b11d ?rX 05@ d'r>b 1 fn(@;8@8h@ hits(lookfor rxmatches string)[;si;]8(X@ leave if no hits `(0@;8@80)@'lookfor si'2(lookfor),<0 SAX80x4@ define subexpression indexXYZ0@9@(@ stringstring,CRs8@(H@ io0 (X@ (default 0=all)0P(X@ lookfor is a pattern optionnaly followed by a subexpression indexsiX`@r' ''ab[aeioyu]c'' showfirst ''not with abxc but OK with aboc!'''56789_`P@rlookfor showall string;io;max;b;CR;d;hits;show;i;cut;si>.Px%P@Px@!x@x@@~@p~@X~@8@0~@~@}@}@@ }@ p}@ 8}@ @ }@|@|@|@x|@`|@@|@|@{@{@{@{@H{@({@z@z@z@z@hz@Hz@ (z@xshowall  =- p@ǎ@ @ @ (0hits)08@ lookfor( @ r>string(r/' ^')(0@ r,1 2lookfor rxmatch string@0 X4@ r0 0''@ 00@r lookfor showfirst stringingr0x8@0@h@@@`@@@x plcshowfirst by co ([^ ']+(Classes@8 .,-./ 012345 6789#@@ simplestring 1 (q@ % "(h@ r "#$%&'()*+,>?1@Ahperr`@@h@ lookfor pattern and outline first find@freNULLz;CPNx}@io C used onwsxir0 @ e'('=pattern 80@ allow to show 1st subexpression:endif8p@;%@о@ N''?@ x@ C32' ' @ @y@ z4Ң1 L_73 0@ io0 0h0@ r(string)0 default result0 @{?@@@ 'regex.regfree' bind 'regfree' SAX@@@ 'regex.regerror' bind 'regerror' SAX6@@@ 'regex.regcomp' bind 'regcomp' SAX@@G@ 'regex.regexec' bind 'regexec' SAX@0@ Define the regex functions:AX00`@ pattern may be overlapping.X00@ This fn is io independent.0X@ of each match. If a subexpression is specified it is shown instead.XXV@ the pattern is found. It returns a boolean list indicating the startXXPx}@ This function is used in conjunction with to find wherePhHHalnum alpha blank cntrl digit graph lower print punct space upper xdigit ilhp`@rpattern OSSPATMATCH string;io;all;code;e;ptr;regcomp;regerror;regexec;regfree;sxi;z;C;N;NULLp.@X@'@@0@؍@@P@ @ @@@ p@ 0@ @ ؋@ @@p@P@8@ @@Ȋ@@@P@ @@@@@ p@0@@ @ ؈@@x@X@@@ @!@"@#Ї@$x@%H@&@ 0 @OSSPATMATCH( hH$. matches any char, ab#c shows this: ^^^^ hb',V12hH$. matches any char, ab#c shows this: ^^^ hV15 hF#wont work on ab#c but works on ab.c ^^^^ hV18`no>not with abxc but OK with aboc! ^^^^ @` V21 P.with ab3c now and abzc! ^^^^ PV24X8same with ab3c now and abzc! ^^^^ XV27`7>not with ab3c but OK with abzc! ^^^^ 7@`V300@`>alpha or spaces matches ab c!!! ^^^^ x`0@V33`@ alpha or spaces matches ab zc!!! ^^^^^ `0V36h@prN'doesnt matches ab4c but matches ab$c!!! ^^^^ @p@V39 eac8@8F@V420xh@0as V45e la0x abec x ^^^^ ^^^^0) V4881 8sV51(P0not abecbi but abecbe... ^^^^^^ P i V54icat@ abbbbbbc abbcabc^^^^^^^^ @x@@V57\r 0p3+dsa7 ^^^ ^^^0yV600 3+dsa_7-31 ^^^^^ 0V63tchX<abbbbbbbc(7bs) abbbbbc (5) abc ^^^^^^^ XfisV660]+0V69H >b 1 "(:(V72Hw b;a  !h!HV75@w$$ name=XXX, surname=XXX, age=18, etc.@V78_9/Now is the time for all good men to ^^^ ^^^ ^^^ learn more about APL and show they too can make ^^^ ^^^ V99pat1Word9No (god m ( @ CRav[10] ar msg abo ho conditionan mak 0@msg signal 11 SAX DYW<@`t:@0(8@msg'assertion failed'@(@X@ signal an exception if condition is false@@(^/@؟@@@@@@@"assertr (CR0(  ]+(@ǖ?@c(b0   X00( [[:alpha:]]+(pe ^^z ^^^   Xp@ eregexec xxx'abnc abbc abc'5buf0 up to 5 subexpressionsXHB@ zregcomp xxx'ab*c'1 pattern 'a', any b's, 'c'H(@ example of useE@(8P@'regex.regfree' bind 'regfree'on;msg88@'regex.regerror'bind 'regerror'(88x@'regex.regcomp' bind 'regcomp''W@( (0J@ r[(~x)/r]E ensure empty]0(x@@ rx\r add elementsC@((P@@ (0xp1p,1)0q@(@@ If the pos is duplicated we insert a null@ xF@ E<'' SAX (E@ rcut 1< str ( (G@ and cut!ns (?@ cut[p0,(,+\ol)~x]1C@((@@ cut(xstr)0 ,,,(XQ@ Prepare cut; account for case where last cut include right charX{@ io0@@{@FC@H@ of each cut. Those are always in even positionsd 2HP Return a list of the pieces of str given Offset and LengthB@P8Pg@'regex.regexec' bind 'regexec',!?~_ܭ}{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789. ':  |`#@"%&徼е뱿    !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     @   x@а@@@x@`@H@0@@@@Ȯ@@@h@H@(@@@Ȭ@@@h@xe@@@إ@@@@x@`@H@@P@@p@ @@@@Ȟ@@(@p@X@@@Ȝ@@؛@@@8@ @x@`@0@@@@x@`@0@@ؘ@@p@X@ @@ؗ@@@x@@@(@@@@@(@ȕ@ @P@8@@"Ȕ@x@#`@@$@@%h@@&@@'`@X@Ȇ@@@@h@P@@>@ 0@;@ @ ;@ +@P:@ @Ѕ@@@ H@(@@@@.@h@ @@@y@y@y@y@5y@1hy@Py@x@w@60v@v@v@u@u@u@@r@Pk@Pj@xh@c@ b@Xc@b@Y@>@>@>@=>@>@p>@<@x9@`9@H9@0@dA<OD/;8U:EP H?I9K4J3BYWQCRGVXN>-T,F2SL7*) (M !@