Backslash-escaped space characted sometimes not converted to quoted strings, so formatted string contains extra slashes.
This commit is contained in:
parent
85dfd8b00b
commit
53ac682ba7
|
@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
|
|
||||||
- Fix handling for escaped enclosures and new lines in CSV Separator Inference
|
- Fix handling for escaped enclosures and new lines in CSV Separator Inference
|
||||||
- Fix MATCH an error was appearing when comparing strings against 0 (always true)
|
- Fix MATCH an error was appearing when comparing strings against 0 (always true)
|
||||||
|
- Fix incorrectly handled backslash-escaped space characters in number format
|
||||||
- Fix wrong calculation of highest column with specified row [#700](https://github.com/PHPOffice/PhpSpreadsheet/issues/700)
|
- Fix wrong calculation of highest column with specified row [#700](https://github.com/PHPOffice/PhpSpreadsheet/issues/700)
|
||||||
- Fix VLOOKUP
|
- Fix VLOOKUP
|
||||||
- Fix return type hint
|
- Fix return type hint
|
||||||
|
|
|
@ -614,7 +614,7 @@ class NumberFormat extends Supervisor
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert any other escaped characters to quoted strings, e.g. (\T to "T")
|
// Convert any other escaped characters to quoted strings, e.g. (\T to "T")
|
||||||
$format = preg_replace('/(\\\([^ ]))(?=(?:[^"]|"[^"]*")*$)/u', '"${2}"', $format);
|
$format = preg_replace('/(\\\(((.)(?!((AM\/PM)|(A\/P))))|([^ ])))(?=(?:[^"]|"[^"]*")*$)/u', '"${2}"', $format);
|
||||||
|
|
||||||
// Get the sections, there can be up to four sections, separated with a semi-colon (but only if not a quoted literal)
|
// Get the sections, there can be up to four sections, separated with a semi-colon (but only if not a quoted literal)
|
||||||
$sections = preg_split('/(;)(?=(?:[^"]|"[^"]*")*$)/u', $format);
|
$sections = preg_split('/(;)(?=(?:[^"]|"[^"]*")*$)/u', $format);
|
||||||
|
|
|
@ -88,6 +88,11 @@ return [
|
||||||
12345.678900000001,
|
12345.678900000001,
|
||||||
'$ #,##0.000',
|
'$ #,##0.000',
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'12,345.679 €',
|
||||||
|
12345.678900000001,
|
||||||
|
'#,##0.000\ [$€-1]',
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'5.68',
|
'5.68',
|
||||||
5.6788999999999996,
|
5.6788999999999996,
|
||||||
|
|
Loading…
Reference in New Issue