CAPL Script

StrReplaceRegex

Syntax

long str_replace_regex(char s[], char pattern[], char replacement[])

Function

Replaces all occurrences of pattern in a string with another string.

Parameters

s String to be modified.

pattern

Regular expression which determines the parts in s which shall be replaced. For the regular expression, the same syntax is used as in the Perl programming language.

replacement

Replacement for the parts which match the pattern.

Return Values

1 if successful, 0 if the resulting string would be too long for the buffers.

char buffer[70] = "Vector Informatik";str_replace_regex(buffer, "Inf[a-z]*", "CANoe");write(buffer);

str_match_regex | str_replace | strstr_regex | String Literal