I'm composing a complex regular expression and the user can supply a part of the expression. However, the user-supplied part should be interpreted literally, i.e. regexp special characters should be escaped. Is there a function for escaping these characters? It seems like a common thing to do but all my googling was unsuccessful.
Example:
(re-search-forward (format "\b%s\b" user-string))
If user-string
is test*case
, I want to match test*case
but not testttttcase
.