[reg_exp] implements a regular expression evaluator based on the following regular expression syntax.
Literal
Construction
| Character set | ' Literal ... ' |
| String | " Literal ... " |
| Any character | . |
| Character range | Expression .. Expression ( single character expressions ) |
| Subexpression | ( Expression ) |
| Option | [ Expression ] |
| Expression ? | |
| Iteration ( 0.. ) | { Expression } |
| Expression * | |
| Iteration ( 1.. ) | Expression + |
| Iteration ( n ) | Expression Number |
| Iteration ( n..m ) | Expression Number, Number |
| Union | Expression | Expression |
| Difference | Expression - Expression |
| Concatenation | Expression Expression |
| Reg_T | Abstract regular expression evaluation type |
void REG_drop(Reg_T pReg) | removes regular expression evaluator 'pReg' |
Reg_T REG_create
(
c_string szRegExp, long lLen,
c_string szCharSet, c_bool bIgnCase
)
#define REG_CREATE(exp) REG_create((exp),-1,(c_string)NULL,C_False)
#define IREG_CREATE(exp) REG_create((exp),-1,(c_string)NULL,C_True)
| creates a regular expression evaluator from string 'szRegExp' 'lLen' : -1 or string size in bytes, incl. terminating bytes 'szCharSet': NULL,"" or character set name ( UCS4, UTF-8, MS:CodePage / GNU:iconv-based ) 'szCharSet' = NULL,"" --> single byte string 'lLen' = -1 --> null-terminated single byte or utf8 string RC: evaluator or NULL |
c_bool REG_recreate
(
Reg_T pReg, c_string szRegExp, long lLen,
c_string szCharSet, c_bool bIgnCase
)
#define REG_RECREATE(reg,exp) REG_recreate((reg),(exp),-1,(c_string)NULL,C_False)
#define IREG_RECREATE(reg,exp) REG_recreate((reg),(exp),-1,(c_string)NULL,C_True)
| updates regular expression evaluator 'pReg' from string 'szRegExp' ( 'lLen', 'szCharSet' --> see function 'REG_create' ) RC: true <--> OK |
c_string REG_match
(
Reg_T pReg,
c_string szTxt, long lTxtLen, c_string szCharSet,
long* lPatLen
)
#define REG_MATCH(reg,txt,len) REG_match((reg),(txt),-1,(c_string)NULL,(len))
| applies regular expression evaluator 'pReg' to string 'szTxt' ( 'lTxtLen', 'szCharSet' --> see function 'REG_create' ) RC: start postion of first matched value in 'szTxt' or NULL 'lPatLen' != NULL --> length of first matched value in bytes |