The stupid question is the question not asked | |
PerlMonks |
Re: Regexes on Streams (a partial solution?)by BrowserUk (Patriarch) |
on Oct 12, 2003 at 02:14 UTC ( [id://298578]=note: print w/replies, xml ) | Need Help?? |
Starting with tilly's idea, and attempting to generalise it, I came up with this.
The sub Re_Stream(), takes a regex and a coderef. The regex can be any regex (in theory:), and the coderef should be a function that will extend the stream beyond it's current limit. This function should return true if it has extended the stream, and false if there is no more to come. As coded, the while running the regex will continue to match against the stream until the extender function returns false. I'm not sure if this is progress. The upside is that you no longer have to inspect the user's regex in ordr to work out where to insert the code block to extend the buffer. In fatc you don't have to modify the user regex at all. However, there are a couple of problems with it as it stands.
I've only made a half-hearted attempt at fixing these so far, but thought that I would throw it open to see if anyone else can take it further, or dismiss it as unworkable. Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham"Think for yourself!" - Abigail Hooray!
In Section
Meditations
|
|