Owning Class: string
Requires: MathScript RT Module
c = regex_replace(a, format, b)
c = regex_replace(a, format, b, option)
c = regex_replace(a, format, b, n)
Legacy Name: regexprep
Searches for a regular expression in the input string a and replaces the matched string with string b.
| Name | Description | ||||||
|---|---|---|---|---|---|---|---|
| a | Specifies the string in which you want to perform a string replacement. | ||||||
| format | Specifies the pattern for which you want to search in a. | ||||||
| b | Specifies the string that replaces each matched string in a. | ||||||
| option | Specifies additional options for the search and replace operation. option is a string that accepts the following values.
|
||||||
| n | Directs LabVIEW to replace only the first n matched strings. If you do not specify n, LabVIEW replaces all matched strings in a. |
| Name | Description |
|---|---|
| c | Returns the edited string with the replaced characters. |
a = 'Run regex_replace in LabVIEW MathScript';
format = 'L[a-zA-Z]+W';
c1 = regex_replace(a, format, 'MathScript')
a = 'Run regex_replace in LabVIEW MathScript';
format = 'L[a-z]+W';
c2 = regex_replace(a, format, 'MathScript', 'ignorecase')
c3 = regex_replace(a, format, 'MathScript', 'preservecase')
a = 'Run regex_replace in LABVIEW MathScript';
format = 'L[a-z]+W';
c4 = regex_replace(a, format, 'MathScript', 'preservecase')