Functions

Regex management

Functions

int preg_match (const char *expr, char *str, char ***matches, int *nmatches)
 Check if a string matches a regular expression.
char * str_replace (char *str, char *orig, char *rep)
 Replace the content of 'orig' in 'str' with 'rep'.
char * str_replace_all (char *str, char *orig, char *rep)
 Replace all of the occurrences of 'orig' in 'str' with 'rep'.

Function Documentation

int preg_match ( const char *  expr,
char *  str,
char ***  matches,
int *  nmatches 
)

Check if a string matches a regular expression.

Parameters:
expr Regular expression to be matched
str String to be checked
matches Reference to a char** that will contain the submatches (NULL if you don't need it)
nmatches Reference to a int containing the number of submatches found (NULL if you don't need it)
Returns:
-1 if the regex is wrong, 0 if no match was found, 1 otherwise
char* str_replace ( char *  str,
char *  orig,
char *  rep 
)

Replace the content of 'orig' in 'str' with 'rep'.

Parameters:
str String to work on
orig String to be replaced
rep Replacement for 'orig'
Returns:
The string with the replacement
char* str_replace_all ( char *  str,
char *  orig,
char *  rep 
)

Replace all of the occurrences of 'orig' in 'str' with 'rep'.

Parameters:
str String to work on
orig String to be replaced
rep Replacement for 'orig'
Returns:
The string with the replacement
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines