On Sat, Jan 19, 2002 at 02:52:15PM +0000, Robin Houston wrote: > Can you write a regex which matches only shrinkable strings? > No, you're not allowed to use embedded code constructs ;-)
print join ' : ', $_, shrinkable( $_ ), "\n" for qw/ foo bar gorilla camel effort /; sub shrinkable ($) { if( my @a = /\A(.+)(.+)\Z(?(?{$2 && $2 lt $1}).*|.)/ ) { return yes => sort @a; } else { return 'no'; } } But using ?{} is cheating, I guess? Joy, `/anick -- "Just friends" means "I don't just want you to mourn the loss; I want to remind you of it every day. I want you to suffer. I want you to envy. I want you to die slowly, a bit at a time. And I want you to smile and thank me for it." - someone on alt.gothic