prg_string_regexp_match()
Abstract
Returns whether a match for the specified regular expression can be found in the specified source string and, optionally, the starting position and maximum length of the first match.
Syntax
prg_string_regexp_match (string, regexp, options, start_offset_ptr, match_length_ptr)
| Argument | Type | Description |
|---|---|---|
string |
const char * |
The string to search |
regexp |
const char * |
The regular expression to search with |
options |
int |
Match options (see Details) |
start_offset_ptr |
int * |
Pointer to memory for returning the starting position of the first regular expression match in the searched string. The pointer value can be VOSC_NIL. |
match_length_ptr |
int * |
Pointer to memory for returning the maximum length of the first regular expression match in the searched string. The pointer value can be VOSC_NIL. |
Return Type
int
VOSC_TRUE if a match was found; VOSC_FALSE if not.
Header
prg_string_funcs.h
Details
The options argument controls how the regular expression is parsed. options should be an OR’ed combination of one or more of the following symbolic constants:
PRGC_STR_REGEXP_OPT_IGNORE_CASE—means that “a-z” will match “A-Z” and vice versa.PRGC_STR_REGEXP_OPT_IGNORE_SUBEXP—Indicates that “\0”–”\9” elements in the regular expression should not be expanded as previously encountered parenthetical subexpressions.PRGC_STR_REGEXP_OPT_LINE_MATCH—Indicates that there will be a match only if the entire source string fulfills the regular expression.PRGC_STR_REGEXP_OPT_NEWLINE_AS_CHAR—Indicates that newlines (“\n”) in the source string should be matched by “.” expressions.PRGC_STR_REGEXP_OPT_NOT_LINE_START—Indicates that the beginning of the source string does not correspond to the beginning of a line, so will not match the “^” expression.PRGC_STR_REGEXP_OPT_NOT_LINE_END—Indicates that the end of the source string does not correspond to the end of a line, so will not match the “$” expression.
The start_offset_ptr and match_length_ptr arguments return value pointers. If non-NIL and if there is a match, these contain where in the source string the match starts and how long the matching substring is.