Bug 143205 - Regular expression find/replace - odd behaviour when specific formatted date ; EDITING
Summary: Regular expression find/replace - odd behaviour when specific formatted date ...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.0.6.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-05 15:33 UTC by Grobe
Modified: 2022-05-10 06:21 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
sample spreadsheet with date formating (10.87 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-07-05 15:35 UTC, Grobe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Grobe 2021-07-05 15:33:32 UTC
This behaviour is the same on two different OS/version combinations:

PC #1:
Version: 6.4.7.2 (x86)
Build ID: 639b8ac485750d5696d7590a72ef1b496725cfb5
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: GL; VCL: win; 
Locale: nb-NO (nb_NO); UI-Language: en-US
Calc: threaded

PC #2:
Version: 7.0.6.2
Build ID: 00(Build:2)
CPU threads: 4; OS: Linux 5.12; UI render: default; VCL: gtk3
Locale: nb-NO (en_US.UTF-8); UI: en-US
Calc: threaded

Steps to reproduce:
* Open one of the two files attached.
* Select B coloumn and do a Search and replace
 - Select "Regular expression" and Search In Formulas.
 - In search field: ([:digit:][:digit:]\:[:digit:][:digit:]\:[:digit:][:digit:])\.([:digit:])
 - In replace field: $1,$2
 - Hit Replace all

Expected behavior :
This search and replace is meant to replace the dot with a comma, according to the current locale settings.
The cells should now yeld hour-minute-seconds and 1/100 seconds.

Observed behavior :
The result does not comply with the regex, but instead it strip away the two first numbers - say it looks like the outcome is forced to comply according to the formatting of the cell instead of what the regex expression tell it to.

In cell B2, that contain "05:46:55.97"
 - expected cell value to become "05:46:55,97" (but appear as "46:55,97" according to the time formatting)
 - But cell content actually becomes "46:55,97"
Comment 1 Grobe 2021-07-05 15:35:58 UTC
Created attachment 173370 [details]
sample spreadsheet with date formating
Comment 2 [REDACTED] 2021-07-06 11:18:31 UTC
- initial values are not dates but text (activate "View -> Value Highlighting")
- initial values are marked with an apostrophe (in some locales; eg. in en_US locale) indicating that LibreOffice knows that they could be a time or they are pure text in other locales (without an apostrophe; eg. in an de_DE locale)
- changing "." (dot) to comma also triggers the data type conversion from type "Text" to type "Number" (the beginning apostrophe disappears) 
- the time being displayed *after* conversion to time now depends on the default time format.
- changing the format to "HH:MM:SS,00" shows the expected value

From my perspective not a bug.