mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-24 02:59:34 +00:00
Escape decimal point and add slash to valid unit characters to be able to pick up for example "ppm/°C"
This commit is contained in:
parent
01b371c6c8
commit
77b28327c8
1 changed files with 1 additions and 1 deletions
|
|
@ -106,7 +106,7 @@ class ParameterDTO
|
||||||
*/
|
*/
|
||||||
public static function splitIntoValueAndUnit(string $value): ?array
|
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-z_\/]+\s?\w{0,4})$/iu', $value, $matches)) {
|
||||||
$value = $matches['value'];
|
$value = $matches['value'];
|
||||||
$unit = $matches['unit'];
|
$unit = $matches['unit'];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue