Skip to content

Commit ef6f7ce

Browse files
committed
Improve StringParser regex
Ensures the correct position of the dash for negative values.
1 parent db93106 commit ef6f7ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/FileSize/Parser/SizeStringParser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class SizeStringParser
1818
* - 123 MB
1919
* - 1 gigabytes
2020
*/
21-
const SIZE_STRING_PATTERN = '/^([0-9\.-]+)\s*?([A-Za-z]+)?$/';
21+
const SIZE_STRING_PATTERN = '/^(-?[0-9\.]+)\s*([A-z]+)?$/';
2222

2323
/**
2424
* Parse a size string into its parts (value, unit).

0 commit comments

Comments
 (0)