Member of the string class.
c = regexprep(a, format, b)
c = regexprep(a, format, b, option)
c = regexprep(a, format, b, n)
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. |
If you specify 'preservecase', the matched string in a must follow one of the following capitalization patterns:
a = 'Run regexprep in LabVIEW MathScript';
format = 'L[a-zA-Z]+W';
c1 = regexprep(a, format, 'MathScript')
a = 'Run regexprep in LabVIEW MathScript';
format = 'L[a-z]+W';
c2 = regexprep(a, format, 'MathScript', 'ignorecase')
c3 = regexprep(a, format, 'MathScript', 'preservecase')
a = 'Run regexprep in LABVIEW MathScript';
format = 'L[a-z]+W';
c4 = regexprep(a, format, 'MathScript', 'preservecase')