[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[FWP] Matching regexp's at a stream of data?



Hi perl people,

I'm working on a rewriting web-proxy (free, of course :-). 
The idea is that there is a list of regexps to be matched
against everything that goes through the proxy, with the
possibility of changing the stream if there is a match.
Simple example:
    Look for /<font size=[12]>/ and 
replace with '<font size=3>'.

The problem I'm facing is finding a good way to match
(possibly many) regexps against a stream. The stream may be very 
large so I want to start doing matched before the end of the stream
has been reached.
To make this easier, every regexp has a parameter that specifies 
the maximum number of bytes to be matched.

Any clever ideas how to code this in perl in a elegant and
fast manner?

Ideas welcome.

-Sven
PS: If you don't understand what I'm talking about, have a look
    at the Windows program Proxomitron, proxomitron.tripod.com
-- 
I know you think you thought you knew what you thought I said,
but I'm not sure you understood what you thought I meant.

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe