Using double quotes in double-quote-escaped regexp query


#1

I'm trying to do a simple contains regexp query, along the lines of .*{searchTerm}.*, and need to escape special characters. I saw this in the Elasticsearch documentation:

"Additionally, any characters (except double quotes) are interpreted literally when surrounded by double quotes: john"@smith.com"

This works well, except that my search term could also contain double quotes. So how can I escape for everything, including double quotes? Is my only option here to manually do a .replace() for each of the special characters?


(system) #2