RegExpr_Parse
- Updated2023-02-21
- 3 minute(s) read
int RegExpr_Parse (const char *regularExpressionText, int caseSensitive, RegExprHandle *regularExpressionHandle);
Purpose
This function parses a regular expression string.
If the string is a valid regular expression, this function returns a value as the regularExpressionHandle parameter, which you can pass to the following functions:
RegExpr_MatchText
RegExpr_Destroy
If the string is not a valid regular expression, RegExpr_Parse returns a negative error number. You can pass this error number to the RegExpr_GetErrorString function. However, in some cases there is more error information than can be encoded in the error number. You can get more detailed information about the result of the last call to this function by calling RegExpr_GetErrorElaboration.
Parameters
| Input | |||||||||||||||||||||||||||||||||||||||||
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||
| regularExpressionText | const char * | A nul–terminated string containing a regular expression. A regular expression consists of the following tokens:
|
|||||||||||||||||||||||||||||||||||||||
| caseSensitive | int | Specify a nonzero value or select Yes in the function panel to match characters on a case–sensitive basis. For example, "chr" matches only "chr" and not "CHR". Specify 0 or select No in the function panel to match characters on a case–insensitive basis. For example, "chr" matches "chr", "CHR", and "Chr". This parameter does apply to ranges. For example, if this parameter is non–zero, then "[a–z]" in the regular expression string would match any lowercase letter. If this parameter is zero, then "[a–z]" matches any letter. |
|||||||||||||||||||||||||||||||||||||||
| Output | |||||||||||||||||||||||||||||||||||||||||
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||
| regularExpressionHandle | RegExprHandle | A handle that represents the parse regular expression. You can pass this handle to the following functions: RegExpr_GetFirstCharVec RegExpr_MatchText RegExpr_Destroy When you are done with the regular expression, call RegExpr_Destroy on the handle. Otherwise, you will lose some memory. |
|||||||||||||||||||||||||||||||||||||||
Return Value
| Name | Type | Description | ||||||||||||||||||||||||||||||
| parseStatus | int | Indicates if the regular expression was parsed successfully. If the string is not a valid regular expression, a negative error number is returned. You can pass this error number to the RegExpr_GetErrorString function. However, in some cases there is more error information than can be encoded in the error number. You can get more detailed information about the result of the last call to this function by calling RegExpr_GetErrorElaboration. The error numbers are:
|
Additional Information
Library: Regular Expressions
Include file: toolbox\regexpr.h
LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later