Performs search and replacestring substitution.
pattern A scalar string specifying the regular expression for the search pattern.
repl The replacement scalar string.
NOTE: STRSUBST uses regular expressions, not wildcard characters, for pattern matching. To use STRSUBST, it is crucial that you understand regular expressions. For a detailed discussion of regular expressions, see the chapter Working with Text in the PV-WAVE Programmer's Guide.
.pro
files is converted to .cpr
files.
source = 'foo.pro, bar.pro' cprfiles = STRSUBST(source, 'pro', 'cpr', $ /Global)
PRINT, cprfiles
foo.cpr, bar.cpr
.pp
to .dat
.
str1='$MDATA/ppt/thefile.pp'
str2=STRSUBST(str1, '.pp', '.dat'
PRINT, str2 $MYDATA/.datt/thefile.pp
\
), as follows:
str2=STRSUBST(str1, '\\.pp', '.dat') PRINT, str2 $MYDATA/ppt/thefile.dat
NOTE: Two backslashes are needed because in PV-WAVE strings, you need a pair of backslashes to make a single backslash. For more information on this subject, see the chapter Working with Text in the PV-WAVE Programmer's Guide.