This shows you the differences between two versions of the page.
— |
regcomp_cs [2009/06/02 15:52] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | # $EPIC: regcomp_cs.txt,v 1.4 2009/03/21 05:49:29 zwhite Exp $ | ||
+ | ======Synopsis:====== | ||
+ | $[[regcomp_cs]](<regex pattern>) | ||
+ | |||
+ | ======Technical:====== | ||
+ | This function compiles a regex into a form suitable for passing to the other | ||
+ | [[regex]] functions. A regex compiled by this function is case-sensitive. | ||
+ | |||
+ | See the [[regex]] page for more info. | ||
+ | |||
+ | ======Returns:====== | ||
+ | A string representation of a regular expression suitable for further use. | ||
+ | |||
+ | ======Example:====== | ||
+ | |||
+ | <file> | ||
+ | @orig_string = "ABC DEF"; | ||
+ | @pattern = regcomp_cs(abc); | ||
+ | if (regerror($pattern)) { | ||
+ | xecho -b Error compiling regex: $regerror($pattern); | ||
+ | }; | ||
+ | if (regexec($pattern $orig_string) == 0) { | ||
+ | xecho -b It matched!; | ||
+ | } else { | ||
+ | xecho -b Regex error: $regerror($pattern); | ||
+ | }; | ||
+ | @regfree($pattern); | ||
+ | </file> | ||
+ | |||
+ | When run, this will return: | ||
+ | |||
+ | <file> | ||
+ | *** Regex error: No match | ||
+ | </file> | ||
+ | |||
+ | ======History====== | ||
+ | This function first appeared in epic4-1.029. | ||
+ | |||