in reply to Regexing an input stream...

hmmm i have done the following
while ( $line = <Stream> ) { if ( $line =~ m/blah/ ){ print "here\n"; } }

Replies are listed 'Best First'.
Re: Re: Regexing an input stream...
by sergio (Beadle) on Jun 18, 2003 at 21:54 UTC
    You have not read the original post very carefully...
      he/she almost answered it.
      while ($line .= <Stream>) { exit if ( $line =~ m/b\n*l\n*a\n*h/m); }
        He/She did not understand the scope of the request. Probably the posted request was not too clear.

        I don't want to match things on a line by line only and I don't want to modify $/ to read other types of chunks of text. Just set $/= undef.

        The deeper problem is how to apply a regular expression with multiple matches options to a stream so I don't have to load large pieces of the file and to re-start the reglar expression if it fails.

        So far one of the suggestions makes possible sense... if the regex engine can be tricked into working with an expanding buffer.

        Sergio