mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-23 18:49:34 +00:00
Fix RegEx to include negative values
This commit is contained in:
parent
0d6ab793ce
commit
96a9f4cdda
1 changed files with 2 additions and 2 deletions
|
|
@ -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'];
|
||||
|
||||
|
|
@ -115,4 +115,4 @@ class ParameterDTO
|
|||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue