regexptranslate

regexptranslate('escape', exp) returns exp for which special characters have been transformed into literal characters, adding a backslash.

Examples

>> str = 'End.'; 

% dot is a special character to match any character

regexp(str, '.')# 1 2 3 4 >> exp = regexptranslate('escape', '.')# \. >> regexp(str, exp)# 4

See also

regexp | regexprep