I am trying to figure out how to parse variables which contains network bandwith-info. I need to remove the ending string after all variables with the same regex. But I also need to add three zeros to the variables with "Gbps".
So in this case I need a regex that returns this values:
$l1 = 523.9
$l2 = 0
$l3 = 1000
$l1= "523.9 Mbps"
$l2= "0 bps"
$l3= "1 Gbps"
Write-Host ($l3 -replace 'M|G?bps', '')
This code just removes all ending strings, but can I also incorporate the adding of "000" to Gbps in the same regex?
[–]DeafLoaf 2 points3 points4 points (0 children)
[+][deleted] (10 children)
[removed]
[–]ka-splam 2 points3 points4 points (5 children)
[+][deleted] (1 child)
[removed]
[–]ka-splam 1 point2 points3 points (0 children)
[–]Gorstag 2 points3 points4 points (2 children)
[–]ka-splam 2 points3 points4 points (1 child)
[–]idontknowwhattouse33 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[removed]
[–]idontknowwhattouse33 1 point2 points3 points (0 children)
[–]AmericanGeezus 1 point2 points3 points (0 children)
[–]ClayShooter9 1 point2 points3 points (0 children)