in reply to Regex problem

I would restructure the code to be less clever but easier to debug:

if( $html !~ m!<span class="remaining-data">\s*(.*?)used\s*</span>! ) +{ die "Couldn't find 'remaining-data' span in html!"; }; my $remaining = $1; if( $remaining !~ m!^(\d+(?:\.\d+))(MB|GB)$! ) { die "Weirdo string instead of remaining data: [$remaining]"; }; my ($DataUsed, $unit) = ($1,$2);