#include <stdio.h>
#include <string.h>
#include "../../basext.h"
#include <sys/types.h>
#include "regex.h"
Go to the source code of this file.
Data Structures | |
struct | _ModuleObject |
struct | list |
Defines | |
#define | RE_REG_NOMATCH 0x00080001 |
#define | RE_REG_BADPAT 0x00080002 |
#define | RE_REG_ECOLLATE 0x00080003 |
#define | RE_REG_ECTYPE 0x00080004 |
#define | RE_REG_EESCAPE 0x00080005 |
#define | RE_REG_ESUBREG 0x00080006 |
#define | RE_REG_EBRACK 0x00080007 |
#define | RE_REG_EPAREN 0x00080008 |
#define | RE_REG_EBRACE 0x00080009 |
#define | RE_REG_BADBR 0x0008000A |
#define | RE_REG_ERANGE 0x0008000B |
#define | RE_REG_ESPACE 0x0008000C |
#define | RE_REG_BADRPT 0x0008000D |
#define | RE_REG_EMPTY 0x0008000E |
#define | RE_REG_ASSERT 0x0008000F |
#define | RE_REG_INVARG 0x00080010 |
#define | reset_pmatches(p) |
#define | SBCASE 0x0001 |
#define | SBNEWLINE 0x0002 |
#define | ReleaseList(X) release_list(pSt,(X)) |
Typedefs | |
typedef _ModuleObject | ModuleObject |
typedef _ModuleObject * | pModuleObject |
Functions | |
static int | ConvertError (int Error) |
besVERSION_NEGOTIATE | return (int) |
if (if(p->iErrorRegcomp=regcomp(preg==NULL) | |
besDEREFERENCE (vString) | |
if (p->iErrorRegex=regexec(pmatch==NULL) | |
besDEREFERENCE (vReplace) | |
if (vReplace) | |
besFREE (pmatch) | |
besFREE (preg) | |
besEND | besFUNCTION (nmatch) |
if (((unsigned) n)) | |
if (iError) | |
besALLOC_RETURN_STRING (i) | |
static void | release_list (pSupportTable pSt, struct list *p) |
besFUNCTION (replace) | |
for (iStart=0;((unsigned) iStart)< STRLEN(vString);) | |
if (((unsigned) iTerm)< STRLEN(vString)) | |
regfree (preg) | |
for (item=root;item;item=item->next) | |
ReleaseList (root) | |
Variables | |
vRegexp = besCONVERT2STRING(vRegexp) | |
preg = (regex_t *)besALLOC(sizeof(regex_t)) | |
nmatch = preg->re_nsub + 1 | |
vString = besARGUMENT(1) | |
vString = besCONVERT2STRING(vString) | |
pmatch = (regmatch_t *)besALLOC(sizeof(regmatch_t) * nmatch ) | |
vReplace = besARGUMENT(3) | |
vReplace = besARGUMENT(1) | |
vReplace = besCONVERT2STRING(vReplace) | |
i = 0 | |
iError | |
iError | |
vRegexp = besCONVERT2STRING(vRegexp) | |
preg = (regex_t *)besALLOC(sizeof(regex_t)) | |
nmatch = preg->re_nsub + 1 | |
vString = besARGUMENT(1) | |
vString = besCONVERT2STRING(vString) | |
vReplace = besARGUMENT(3) | |
vReplace = besCONVERT2STRING(vReplace) | |
i = 0 | |
i = 0 |
|
Definition at line 54 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 49 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 41 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 52 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 48 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 46 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 42 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 43 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 44 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 53 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 47 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 50 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 51 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 45 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 55 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 40 of file interface.c. Referenced by ConvertError(). |
|
Definition at line 460 of file interface.c. Referenced by if(). |
|
Value: |
|
|
|
|
|
=H The module RE This module implements some simple regular expression handling functions. They can be used to match some strings against regular expressions and to use matched sub strings to format replace strings. This module provides functions that are similar to the Perl language operators T<m//> and T<s///>. |
|
=H The module RE This module implements some simple regular expression handling functions. They can be used to match some strings against regular expressions and to use matched sub strings to format replace strings. This module provides functions that are similar to the Perl language operators T<m//> and T<s///>. |
|
|
|
|
|
|
|
|
|
|
|
=section replace =H Search and replace =verbatim re::replace(string,regexp,replace) re::s(string,regexp,replace) =noverbatim This function searches the string for matches of the regular expression and replaces the actual matches with the replace string. This is the same functionality as the T<=~s/> operator in Perl. The function fills the R<dollar> array the same way as the function R<match>. For example =verbatim import re.bas print re::s("almakbat*","a(.)","$1s") print print re::$(0)," ",re::$(1) print =noverbatim will print =verbatim lsmksbts* at t =noverbatim As you can see in this case the value of T<re::$(0)> is the string that was matched by the last replace inside the string. Definition at line 494 of file interface.c. References besALLOC_RETURN_LONG, besRETURNVALUE, and LONGVALUE(). |
|
=section n =H number of matches =verbatim re::n() =noverbatim return the number of usable matches substrings Definition at line 327 of file interface.c. References besCONVERT2LONG(), and LONGVALUE(). |
|
Definition at line 57 of file interface.c. References RE_REG_ASSERT, RE_REG_BADBR, RE_REG_BADPAT, RE_REG_BADRPT, RE_REG_EBRACE, RE_REG_EBRACK, RE_REG_ECOLLATE, RE_REG_ECTYPE, RE_REG_EESCAPE, RE_REG_EMPTY, RE_REG_EPAREN, RE_REG_ERANGE, RE_REG_ESPACE, RE_REG_ESUBREG, RE_REG_INVARG, RE_REG_NOMATCH, REG_ASSERT, REG_BADBR, REG_BADPAT, REG_BADRPT, REG_EBRACE, REG_EBRACK, REG_ECOLLATE, REG_ECTYPE, REG_EESCAPE, REG_EMPTY, REG_EPAREN, REG_ERANGE, REG_ESPACE, REG_ESUBREG, REG_INVARG, and REG_NOMATCH. |
|
Definition at line 726 of file interface.c. |
|
Definition at line 554 of file interface.c. References reset_pmatches. |
|
Definition at line 696 of file interface.c. References besFREE(), besRETURNVALUE, COMMAND_ERROR_SUCCESS, memcpy(), NULL, pmatch, preg, regfree(), ReleaseList, STRINGVALUE(), STRLEN(), and vString. |
|
Definition at line 424 of file interface.c. References besRETURNVALUE, COMMAND_ERROR_SUCCESS, and NULL. |
|
Definition at line 363 of file interface.c. |
|
Definition at line 276 of file interface.c. References besALLOC_RETURN_STRING(), besCONVERT2STRING(), besFREE(), besRETURNVALUE, COMMAND_ERROR_SUCCESS, iError, NULL, pmatch, preg, regfree(), STRINGVALUE(), STRLEN(), and vReplace. |
|
Definition at line 224 of file interface.c. |
|
Definition at line 196 of file interface.c. |
|
|
|
Definition at line 450 of file interface.c. |
|
|
|
Definition at line 82 of file interface.c. References reset_pmatches. |
|
Definition at line 730 of file interface.c. |
|
Definition at line 725 of file interface.c. |
|
Definition at line 418 of file interface.c. |
|
Initial value: besMatchParameter(STRINGVALUE(vReplace), STRLEN(vReplace), p->pszMatch, p->lMatchLen, STRINGVALUE(besRETURNVALUE), p->lMatches, &(STRLEN(besRETURNVALUE))) Definition at line 429 of file interface.c. |
|
Initial value: Definition at line 419 of file interface.c. |
|
Definition at line 542 of file interface.c. |
|
Definition at line 216 of file interface.c. |
|
Definition at line 223 of file interface.c. |
|
Definition at line 522 of file interface.c. |
|
Definition at line 195 of file interface.c. Referenced by if(), and regerror(). |
|
Definition at line 521 of file interface.c. |
|
Definition at line 194 of file interface.c. |
|
Definition at line 552 of file interface.c. |
|
Definition at line 550 of file interface.c. |
|
Definition at line 417 of file interface.c. |
|
Definition at line 412 of file interface.c. |
|
Definition at line 274 of file interface.c. Referenced by if(). |
|
Definition at line 547 of file interface.c. |
|
Definition at line 544 of file interface.c. |
|
Definition at line 221 of file interface.c. |
|
Definition at line 218 of file interface.c. |