🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #2240

Seeking partial match for regexp.

#2240
From: La Monte Yarroll
Date: Thu, 28 Jan 1993 08:36
30 lines
1909 bytes
I'm writing a filter for an emacs process which looks for commands in
the output stream.  The commands are removed and executed.  Anything
that is not a command just gets inserted into the buffer.

I'm using an accumulator-style filter where the filter just appends
the new output to an accumulator, and calls a function to process the
current accumulator.

I'd like to use a regexp like "cmd1\\|cmd2\\cmd3" to recognize
commands in the accumulator.  I'd like to be able to find the first
full or _partial_ match in the accumulator.  By partial match I mean a
match that fails only because we got to the end of the accumulator.
If the match was only partial, just insert the junk before the partial
match, and then wait for the next invocation of the filter.

I think I could do this with the GNU regexp package, but I don't seem
to have as much flexibility with the elisp regexp stuff.

Can somebody tell me how to check for a _partial_ match to a regexp?

Or can you suggest a better approach?

For the moment, I'll just pretend that a command will never be split
across two different filter invocations, but I don't like this much.

--
La Monte H. Yarroll	Home:		piggy@baqaqi.chi.il.us
   Work:		piggy@hilbert.maths.utas.edu.au
   AKA:			piggy@gargoyle.uchicago.edu
   Once upon a time:	postmaster@clout.chi.il.us
Technical Details
Message-ID: <piggy.728210161@newsroom.utas.edu.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!udel!bogus.sura.net!howland.reston.ans.net!spool.mu.edu!sgiblab!munnari.oz.au!newsroom.utas.edu.au!hilbert!piggy

Show Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.help
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!udel!bogus.sura.net!howland.reston.ans.net!spool.mu.edu!sgiblab!munnari.oz.au!newsroom.utas.edu.au!hilbert!piggy
From: piggy@hilbert.cc.utas.edu.au (La Monte Yarroll)
Subject: Seeking partial match for regexp.
Message-ID: <piggy.728210161@newsroom.utas.edu.au>
Summary: Want to ask "Could this match if it were longer?".
Keywords: regexp, filter
Sender: news@newsroom.utas.edu.au
Organization: University of Tasmania, Australia.
Date: Thu, 28 Jan 1993 08:36:01 GMT
Lines: 30