LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Privoxy Text Replace (https://www.linuxquestions.org/questions/linux-networking-3/privoxy-text-replace-536475/)

Linuxer12345 03-11-2007 04:35 AM

Privoxy Text Replace
 
Is it possible to define a custom text replace in Privoxy? Say for example that I want to replace all occurrences or "Windows" to "Linux" in the source code of all web pages.

blackhole54 03-13-2007 05:21 AM

Yes, its possible. Unfortunately I am not near my computers that use Privoxy at the moment, so I might get some terminology wrong here. You can use perl style regular expressions (with a few Privoxy extensions) to do the substitution. It involves creating a new filter by editing a file (filter.default ?) and then selecting this filter (via the web interface or via editing the appropriate file(s)) to select which web pages to apply this to.

Make sure you save a backup of any file before you manually edit it. If you screw up the substitution command (as I have done -- magnificently!), you can seriously hose any page that filter gets applied to.

(When you find the correct file to put your new filter in, you will find many existing examples to help guide you. If you are doing anything at all advanced, you might want to get a referrence on perl regular expressions if you are not already familiar with them.)


All times are GMT -5. The time now is 06:24 AM.