Regex reg

From Bennu Wiki
Jump to navigation Jump to search


Up to Global Variables



Definition

STRING[15] regex_reg

Regex_reg is a global variable, holding 16 strings. It holds matches when the functions Regex() and Regex_replace() are used.


Examples

// import modules
IMPORT "mod_say";
IMPORT "mod_debug";
IMPORT "mod_regex";


GLOBAL


   string sourcetext="It's raining cat's and dogs";
   string searchtext="cat"; // the search pattern
   
   int status;
   
PROCESS main();

BEGIN


   // print the joined string
   say("");
   
   // looking for the position of the word "cat"
   status=regex(searchtext,sourcetext);
   
   say("match found at: "+status);
   say("");

   // the last character of a line. 
   status=regex("$","99 bottles of beer on the wall.");
   
   say(status+" is the last character position in 99 bottles of beer on the wall.");
   say("");
   
   say("regex_reg[0]="+regex_reg[0]);
   say("regex_reg[1]="+regex_reg[1]);
   say("regex_reg[2]="+regex_reg[2]);
   say("regex_reg[3]="+regex_reg[3]);
   
   say("regex_reg[4]="+regex_reg[4]);
   say("regex_reg[5]="+regex_reg[5]);
   say("regex_reg[6]="+regex_reg[6]);
   say("regex_reg[7]="+regex_reg[7]);
   
   say("regex_reg[8]="+regex_reg[8]);
   say("regex_reg[9]="+regex_reg[9]);
   say("regex_reg[10]="+regex_reg[10]);
   say("regex_reg[11]="+regex_reg[11]);
   
   say("regex_reg[12]="+regex_reg[12]);
   say("regex_reg[13]="+regex_reg[13]);
   say("regex_reg[14]="+regex_reg[14]);
   say("regex_reg[16]="+regex_reg[15]);
END


Global variables
ArgcArgvAsciiCdinfoDump_typeExit_statusFadingFileinfoFocus_statusFpsFrame_timeFull_screenGraph_modeM7MouseMouse_statusOs_idRegex_regRestore_typeScale_modeScale_resolutionScale_resolution_aspectratioScale_resolution_orientationScan_codeScrollShift_statusSound_channelsSound_freqSound_modeText_flagsText_zTimerWindow_status