I have this
/([^/|#<(>;s][0-9]*[s][KB]{2})
in order to be specific i had to use [KB]{2} I get the value needed, but can I convert the final print to MB?
Exemple: match= 2000KB = 2MB?
Thanks
Sure you can; capture the unit and the number separately like this:
/[^/|#<(>;s]([0-9]*)[s]([KB]{2})
Assuming your original regex is correct, of course. Then:
if ($2 eq "KB" && $1 > 1024) { $1 /= 1024; $2 = "MB"; }
1.4m articles
1.4m replys
5 comments
57.0k users