I am new to regular expressions, and i hope, i didn't overlook any obvious solutions for this problems, but after several hours of searching the Net, i think it is time to just ask.
I Am coding a little javascript that should eventually translate PDF. To do this i intended to use the .replace() method with regex for search. I need to create the regex-expression automatically, because i need to search for quite a few different strings. The problem i am having now, is that many of those strings include special characteres, that are used in regex to modify the search. Obviously this kind of search tends to bring up a lot of nonsense.
The solution with \Q...\E doesn't seem to work either. (I am not sure why, my guess is because i am using javascript for PDFs, and it might not be implemented there.)
I also see the solution of first replacing every single special character with itself and a preceeding "\", but the only way to do this (that i know about) would require quite a few replace methods (one for each special character). So it would not only be easy to overlook a special charcter, it would also slow down the whole process.
If any of you know a solution to this problem, i would be really thankfull!