Chagrined by admonishment for Re: Re: Re: signed bin2dec I thought I would try and improve.
I need to do 2 things:
It seemed natural to do this with a single regex and my first attempt was $string =~ m[^([01])+$] which failed.
There are several ways to fix it, but the manner in which this failed surprised me and whilst I know what it does, I'm not really sure that I can explain why. Any offers?
$_ =~ m[^([01])+$] and print "$_:'$1'" for qw[ 0 1 00 11 10 01 012]; 0:'0' 1:'1' 00:'0' 11:'1' 10:'0' 01:'1'
In reply to Regex failure interpretation by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |