develooper Front page | perl.perl5.porters | Postings from June 2008

Re: Empty regex

Thread Previous | Thread Next
Paul Fenwick
June 18, 2008 22:58
Re: Empty regex
Message ID:
G'day Alfie / p5p, wrote:

> Is there anyway to make /$string/ warn if $string is empty? Maybe even in
> future releases of perl?

I'm in Sydney, teaching a course, and away from my decent research 
materials.  I know that it's possible to overload qr{}, which presumably can 
let us do whatever we want with qr'd regexps.  Does this overload also allow 
us to inspect *any* regexp in the code?  I know overloading integers allows 
us to do whatever we want with all the integers in the code.

If so, it should be easy enough make Regexp::Safer which simply forbids (or 
whines verbosely) about empty regexps.



Paul Fenwick <> |
Director of Training                   | Ph:  +61 3 9354 6001
Perl Training Australia                | Fax: +61 3 9354 2681

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About