April 01, 1999
Regular Expressions
/* match: search for re anywhere in text */
int match(char *re, char *text)
{
if (re[0] == '^')
return matchhere(re+1, text);
do { /* must look at empty string */
if (matchhere(re, text))
return 1;
} while (*text++ != '\0');
return 0;
}
Example 1: The function match determines whether a string matches a regular expression.
Copyright © 1999, Dr. Dobb's Journal
|
|
||||||||||||||||||||||||||||
|
|