StrMatchRegex
This reference collection includes Vector documentation reproduced with permission. Snippets may require configuration-specific symbols and are not all standalone programs. Sources and validation limits.
Syntax
long str_match_regex(char s[], char pattern[])
Function
Checks whether a string completely matches a regular expression pattern.
Parameters
s String to be checked.
pattern
Regular expression against which the string is matched. For the regular expression, the same syntax is used as in the Perl programming language.
Return Values
1 if the string matches the pattern, 0 if it doesn’t match the pattern.
Reference example from the CANoe 12 help. Check the required configuration, database objects and API availability in your installed version; this is not a recorded compiler or runtime test.
char buffer[70] = "Vector Informatik";
long res;
res = str_match_regex(buffer, "Vector [A-Za-z]*"); // 1
res = str_match_regex(buffer, "Inf[a-z]*"); // 0
Related APIs
str_replace | str_replace_regex | strstr_regex | String Literal