1.REXXPCRE.DLL

1.1. PCREAuthor
ᨭ⠪: auth = PCREAuthor()
頥 ப, ᮤঠ   PCRE   email.

1.2. PCREVersion
ᨭ⠪: ver = PCREVersion()
頥 ப, ᮤঠ  ⥪.

1.3. PCREInit
ᨭ⠪: rc = PCREInit([locale])
ࠬ: locale -- ॡ㥬  (᪠ "En_US")
頥: ⢮  ( ᥬ ⥣)
樠 ⥪  . 
᫨ ࠬ  ப,  樠 ⥪饩 
 (. SET LANG  config.sys).
᫨ ࠬ ய饭 -- ᯮ "C" .

-㬮砭, ⥪ ࠡ⠥  "C" .

1.4. PCRECompile
ᨭ⠪: rc = PCRECompile( 'pcre', mask )
ࠬ: 'pcre' --  ६, 㤠 㤥  
                     ᪮஢ ॣ୮ ࠦ
            mask  -- ப  ॣ ࠦ
頥:  訡
     0 - ok
     1 - ४ () 
     2 - ४⭠ ᪠
     3 - ४⭮  ६  pcre
     4 - 訡 樨, ⥪⮢ ப 頥  'pcre'
 ॣ୮ ࠦ  쭥襣 ᯮ짮.

mask   : /regexp/[8|i|m|s|x|g|A|U|E]
  8 -- UTF8
  i -- ॣ  뢠
  m -- multiline
  s -- dot all
  x -- extended
  g -- not empty
  A -- ancored
  U -- ungreedy
  E -- dollar only
 ⠫ﬨ   㪮   Perl  㬥樨  PCRE.  

ਬ:
  if PCRECompile('rec', '/(\d{2}/\d{2}/\d{2,3}) (\d{2}:\d{2}:\d{2}) (\[\d+,\d+\]) . (.*)/') then
    say Error !
  else
    say Success
    
1.5. PCREExec   
ᨭ⠪: rc = PCREExec('pos_stem.',pcre,string,[pos,[,opts])
ࠬ: 'pos_stem.' --  ⥬,  ⮬  ࠭ ᬥ饭.
                          pos_stem.0 -- ᫮ ⮢. 
            pcre       -- ᪮஢ ॣ୮ ࠦ
            string     -- ப
            pos        -- 砫쭠  (-㬮砭 -- 1)
                          㬥 ᨬ   REXX'    .
           opts        -- 樨 (-㬮砭 --  ᯮ)
             A -  Anchored
             b -  Not begin of line
             e -  Not end of line
             g -  Not empty
頥:  訡 
   -1 -  
    0 - Ok
    1 - ४ () 
    3 - ४⭮  ६  pcre
    5 - pcre  ᮤন ᪮஢ ࠦ
    6 - ४⭠ 
 
1.6. InitPCRE
ᨭ⠪: call  PCRELoad
樠 ⥪, ॣ 室 㭪樨

ਬ:
call  RxFuncAdd  'PCRELoad', 'REXXPCRE', 'PCRELoad'
call  PCRELoad


1.7. DropPCRE
ᨭ⠪: call DropPCRE
ॣ 㭪樨

2. REXXPCRE.rex[x]
  :
  RxPCRE 
    |
    +----RxStrParser
  (  ) 㤮 ⪮  㭪 PCREXXXX.
RxStrParser  -   ᯫ⮢ PERL'a.

2.1 ⮤ RxPCRE
2.1.1 init([locale]) -- . PCREInit,  ᪫祭: ᫨ ࠬ ,
                       ᯮ ⥪ 
ਬ:   
  re = .RxPCRE~new
    
2.1.2 getLocale  --  頥 , ਬ  PCRE
ਬ:
  say re~getLocale
  
2.1.3. getMask --  頥 ᯮ㥬 
ਬ:
  say re~getMask

2.1.4. setMask(mask) --  ,   訡; . PCRECompile

2.1.5.  find(ofs_stem., str, [start_pos [,opts]]) --
         ࠣ⮢, 頥  訡; . PCREExec
2.1.6.  findSubs(str, [start_pos [,opts]]) --
         ࠣ⮢, 頥 ᨢ (.array) ப ᫨ ᮢ
        뫨. ᫨ 祣    뫨 訡,  頥 .nil;
         RxPCRE::find, PCREExec.
ਬ:        
  a = re~findSubs("z = zz!")
  if a <> .nil then do /* do smth with data */ end;
  else if re~lastError = -1 then say 'Not found!';
  else say 'error: 're~lastError;
  
2.1.7. lastError --  頥  襭 ᫥ 樨
    
2.1.8. getVersion --  頥  libpcre   ப

2.1.9. getRxVersion -- 頥  REXXPCRE   ப     

2.1.10. getAuthor -- 頥 ப    PCRE

2.1.11. getPortAuthor -- 頥 ப    REXXPCRE

2.2. ⮤ RxStrParser
 RxStrParser ᫥  RxPCRE.
  楫  㤮 ࠧ騪 ப  ⫨稨  PERL'a 
६ . .. ($a,$b,$c) = / /
㤥 ᮮ. sp~parse(str); sp[1], sp[2], sp[3].

2.2.1  init -- 樠 . . RxPCRE::init
    
2.2.2  parse -- ᮡ⢥ ࠧ騪 ப, 頥 1 ᫨  뫮 
                訡  0  ⭮ 砥. 
                . RxPCRE::lastError, RxPCRE::find
                
       rc = sp~parse(str)         
       rc = sp~parse(str,10); /*  樨 10 */

2.2.3. '[]' 頥 ப. ᫨  ,  ४ 
       ᬮ lastError

       
2.3 ਬ       

a = .RxStrParser~new /* 樠 ⥪饩 ,  $LANG */

mask = "/\s*([_a-zA-Z][a-zA-Z0-9._]*)\s*=\s*([^#]*)(#|$)(.*)/"

if a~setMask(mask) <> 0 then do
  say 'Oops! Error: ' a~lastError
  exit -1
end;

say a~parse("a2 = 3"); /* ࠧઠ ப */
say a[1] /* 'a2'*/
say a[2] /*3*/

exit 0


    
    
