🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1053

Re: REGEX: "re_might_match()" possible ? (NO BUG)

#1053
From: bothner
Date: Sat, 07 Nov 1992 11:10
27 lines
1442 bytes
> We need a function to see if input MIGHT match.
> Which means, we would like to check if a string matches
> NOT AFTER typing in the whole string, BUT MEANWHILE
> the user is typing.

I hacked GNU regex to support something like that.
Basically, there is a special error code indicating that
the match failed because there wasn't enough input (we reach
end fo the input string).

I used this to efficiently implement a multi-level glob:
I wanted to have
	echo PATTERN
act as if it were:
	echo `find . -print|ggrep PATTERN`
(where ggrep would use extended ksh-style globbing syntax for regexes).

The regex extension is to avoid expanding useless directories
(ones that could not match the pattern).

The same relatively simple modification to regex could work
for your problem.   My code is part of the Q language
(pub/Q.tar.Z on cygnus.com); I can mail my heavily-hacked
regex separately, if you want.

	--Per Bothner
Cygnus Support     bothner@cygnus.com
Technical Details
Message-ID: <9211080310.AA27933@cygnus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!bothner
References: <199211061348.AA27125@bredex.de>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!bothner
From: bothner@cygnus.com
Subject: Re: REGEX: "re_might_match()" possible ? (NO BUG)
Message-ID: <9211080310.AA27933@cygnus.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
References: <199211061348.AA27125@bredex.de>
Distribution: gnu
Date: Sat, 7 Nov 1992 11:10:33 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 28