SPUG: minimal unmatching regex

Charles DeRykus derykus at gmail.com
Wed Aug 19 12:28:41 PDT 2009


But wait... if you buy now, we'll throw in an extra $ to
make it work :)

/$$^/

-- 
Charles DeRykus

On Wed, Aug 19, 2009 at 12:38 AM, Ingy dot Net <ingy at ingy.net> wrote:

>
>
> On Tue, Aug 18, 2009 at 10:33 PM, Steve Sandvik <ssandv at gmail.com> wrote:
>
>> well, /$^/ seems like a plausible starting point.  Or ending point.
>> Or something. :-)
>
>
> Nope.
>
>     $^ = "";
>     $anything =~ /$^/;
>
>
>
>>
>>
>> Steve Sandvik
>>
>> On Tue, Aug 18, 2009 at 12:04 PM, Michael R. Wolf<MichaelRWolf at att.net>
>> 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*.
>> >
>> > Here's a stub of the lab...
>> >
>> > # TODO... replace the following line with your regular expression to
>> match
>> > zip codes.
>> > my $zip_re = qr//;
>> >
>> > like('98107', $zip_re, 'Simple 5-digit zip'),
>> > like('07748', $zip_re, 'Simple 5-digit zip with leading zero'),
>> >
>> > unlike('1234',          $zip_re, 'Four digits');
>> > unlike('123456',        $zip_re, 'Six digits');
>> >
>> > --
>> > Michael R. Wolf
>> >    All mammals learn by playing!
>> >        MichaelRWolf at att.net
>> >
>> >
>> >
>> >
>> > _____________________________________________________________
>> > Seattle Perl Users Group Mailing List
>> >    POST TO: spug-list at pm.org
>> > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>> >   MEETINGS: 3rd Tuesdays
>> >   WEB PAGE: http://seattleperl.org/
>> >
>> _____________________________________________________________
>> Seattle Perl Users Group Mailing List
>>     POST TO: spug-list at pm.org
>> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>>    MEETINGS: 3rd Tuesdays
>>    WEB PAGE: http://seattleperl.org/
>>
>
>
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
>     POST TO: spug-list at pm.org
> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>    MEETINGS: 3rd Tuesdays
>    WEB PAGE: http://seattleperl.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20090819/96fa2a86/attachment.html>


More information about the spug-list mailing list