Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

regexprep (MathScript Function) (Windows, Not in Base Package)

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

Member of the string class.

Syntax

c = regexprep(a, format, b)

c = regexprep(a, format, b, option)

c = regexprep(a, format, b, n)

Description

Searches for a regular expression in the input string a and replaces the matched string with string b.

Details

Examples

Inputs

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.

'ignorecase' (default) Ignores the case when searching.
'once' Replaces only the first matched string.
'preservecase' Ignores the case when searching. However, LabVIEW preserves the case of the matched string in a and overrides the characters in b with the original case.
n Directs LabVIEW to replace only the first n matched strings. If you do not specify n, LabVIEW replaces all matched strings in a.

Outputs

Name Description
c Returns the edited string with the replaced characters.

Details

If you specify 'preservecase', the matched string in a must follow one of the following capitalization patterns:

  • The first letter is uppercase, as in Labview
  • All letters are uppercase, as in LABVIEW
  • All letters are lowercase, as in labview
If the matched string uses a different capitalization pattern, such as LabVIEW, LabVIEW uses the 'ignorecase' option instead of the 'preservecase' option.

Examples

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')

Related Topics

regexp
regexpi
regexptranslate
strrep


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit