Navigation

Operators and Keywords

Function List:

C++ API

: regexptranslate (op, s)

Translate a string for use in a regular expression.

This may include either wildcard replacement or special character escaping.

The behavior is controlled by op which can take the following values

"wildcard"

The wildcard characters ., *, and ? are replaced with wildcards that are appropriate for a regular expression. For example:

regexptranslate ("wildcard", "*.m")
     ⇒ ".*\.m"
"escape"

The characters $.?[], that have special meaning for regular expressions are escaped so that they are treated literally. For example:

regexptranslate ("escape", "12.5")
     ⇒ "12\.5"

See also: regexp, regexpi, regexprep.

Package: octave