In a R script, I'd need to create a RegEx that contains strings that may have special characters. So, I should first escape those strings and then use them in the RegEx object.
pattern <- regex(paste('\\W', str, '\\W', sep = ''));
In this example, str
should be fixed. So, I'd need a function that returns escaped form of its input. For example 'c++'
-> 'c\\+\\+'