SPUG: minimal unmatching regex

Joshua Juran jjuran at gmail.com
Tue Aug 18 21:58:44 PDT 2009


On Aug 18, 2009, at 12:04 PM, Michael R. Wolf wrote:

> Question:
> What's the smallest (comprehensible) regex that's guaranteed to  
> fail against all input?
>
> Motivation:
> I'm creating a lab for perl classes.  I want to provide the stub of  
> a script that compiles, but always fails to match.  Unfortunately,  
> the obvious minimal RE of // matches *everything*.

I don't know the syntax of the top off my head, but here's the logic:

* beginning of string (not strictly necessary, but a useful  
optimization)
* negative lookahead assertion for X
* X

Josh




More information about the spug-list mailing list