in reply to Regex 'If Not Match'

The previouse answers are all correct.

But have you really missed the obious way???
if( not ( $reference =~ m/38[0-9]{8}[A-Z]{3}/ )) { $reference = ""; }
And then there is also another way unless you don't like it, you may use:
$reference = "" unless $reference =~ m/38[0-9]{8}[A-Z]{3}/;

$\=~s;s*.*;q^|D9JYJ^^qq^\//\\\///^;ex;print

Replies are listed 'Best First'.
Re^2: Regex 'If Not Match'
by kwaping (Priest) on Sep 30, 2005 at 15:00 UTC
    Personally, I thought !~ was the obvious way. :)