Update RegEx to include %

This commit is contained in:
Frank Fenor 2024-02-24 15:29:52 +01:00
parent a4c553340b
commit 835d0f74ee
No known key found for this signature in database
GPG key ID: E6B5029FCCE96376

View file

@ -106,7 +106,7 @@ class ParameterDTO
*/
public static function splitIntoValueAndUnit(string $value): ?array
{
if (preg_match('/^(?<value>-?[0-9.]+)\s*(?<unit>[Ω°℃a-zA-Z_]+\s?\w{0,4})$/u', $value, $matches)) {
if (preg_match('/^(?<value>-?[0-9.]+)\s*(?<unit>[%Ω°℃a-zA-Z_]+\s?\w{0,4})$/u', $value, $matches)) {
$value = $matches['value'];
$unit = $matches['unit'];