Regular Expressions option Libreoffice Calc 5.1.1.2

7 replies [Last post]
surf637
Offline
Last seen: 6 weeks 6 days ago
Title:
Joined: 11 Apr 2016
Posts: 2
Every time I open a calc file saved in .xlsx format, where i use regular expressions for formulas, I have to reselect “enable regular expressions in formulas” from the “options” menu.

FYI. This spreed sheet is used between 2 computers. one with Windows 10\MSOffice 365 and the other Mint linux 17.3\Libreoffice 5.1.1.2

Is there a way to keep the “enable regular expressions in formulas” option enabled as a default option?

-Julian

Lupp
Lupp's picture
Offline
Last seen: 1 day 16 hours ago
Title: ★★★★★
Joined: 1 Aug 2012
Posts: 1515
I cannot test...
…but I am afraid there is no way.

You surely are aware of the fact that MS is using a different variant (a different engine, a different syntax) of Regular Expressions. Anything relying on the evaluation of RegEx in expressions in Calc may therefore not work or (worse) may work but return different results under Excel.


Currently installed: LibO V5.1.2 on Windows 10
Maybe we might! (Create a powerful UFO: United Free Office!) Lupp from München
oweng
oweng's picture
Offline
Last seen: 5 days 10 hours ago
Title: ==Moderator==
Joined: 26 Jan 2012
Posts: 3281
stored in file
The option is evidently stored in the file however this likely only applies to the native (ODS) file format. Bug tdf#82633 and its duplicate tdf#88581 indicate that it is not possible to please everyone.
surf637
Offline
Last seen: 6 weeks 6 days ago
Title:
Joined: 11 Apr 2016
Posts: 2
Regular expressions
I am only a basic user of excel and new to Calc. Assuming that saving a file using the same xlsx extension as Excel, some if not most of the same functions would be the compatible. Maybe you could enlighten me on why Calc does not use regular expressions while many programming languages rely on the syntax for their searching power. Could you recommend a better option? Thanks for your help.
Lupp
Lupp's picture
Offline
Last seen: 1 day 16 hours ago
Title: ★★★★★
Joined: 1 Aug 2012
Posts: 1515
Strange idea
surf637 wrote:
…why Calc does not use regular expressions while many programming languages rely on the syntax for their searching power.
There were two comments on the original question up to now, one by me and one by oweng (mine may be much less precise and useful). None of these comments is containing anything to the effect of the quoted statement.

Would you (surf637) enlighten me concerning the question what led you to that statement?

I am using regular expressions frequently with Calc functions and with ‘F & R’ in Calc and in Writer.

But: I do not keep documents filed in alien formats. This is known to cause a lot of problems. One of the them seems to be that MS are using their own variant of RegEx together with their own RegEx engine. Anybody getting an XLSX file should expect that the contained formulae and the contained results comply with MS’ own standards. Open documents should be expected to use an open RegEx engine. I am not an expert concerning RegEx software. I thus looked for related information. This wikipedia page seems to contain at least some basics. Concerning LibO I was told once that it is using the ICU RegEx engine. Of course we have to expect some restrictions, in specific when RegEx are used with Calc functions.

Subtleties aside, the keypoint I wanted to stress was that the file format specifications for XLSX (there are variants again) are made to get a persistent representation of Excel documents reviving the original document when opened. The same for ods and Calc. There is no exact mapping of the documents of the one class to files of types specified for the other class. If I am correctly informed also MS did not manage up to date a complete mapping of their documents to odf formats despite the fact that tey at least pretended to try.

Very valuable information with respect to the file-format-issue you will find here.


Currently installed: LibO V5.1.2 on Windows 10
Maybe we might! (Create a powerful UFO: United Free Office!) Lupp from München
oweng
oweng's picture
Offline
Last seen: 5 days 10 hours ago
Title: ==Moderator==
Joined: 26 Jan 2012
Posts: 3281
may not be specified in OOXML
surf637 wrote:
Assuming that saving a file using the same xlsx extension as Excel, some if not most of the same functions would be the compatible. Maybe you could enlighten me on why Calc does not use regular expressions …
To add to what Lupp has stated … this is now a discussion about file format (ODS vs XLS/XLSX), rather than LO vs MSO. I do not want to make this discussion too technical, so the essential aspect is this. In the ODF specification (ODS file extension for spreadsheets) there is an XML attribute (to a general calculation settings option) used to indicate whether regular expressions are to be used or not. By default the value is “true” i.e., use regular expressions. But that is in ODF. In OOXML (XLSX file extension for spreadsheets) a search through the specification for “regular expression” only highlights examples that are not related to storing any setting. It may be that the OOXML file format as specified does not store this information.
Kabel
Offline
Last seen: 2 weeks 6 days ago
Title: ★★★★★
Joined: 16 Feb 2011
Posts: 103
workaround - Autohotkey
If this is a task (series of mouse click and keypresses) you repeat very often, I recomend you to see if you can use Autohotkey.

Unfortunately, Autohotkey is a Window-only program.

Wanderer
Offline
Last seen: 6 weeks 3 days ago
Title:
Joined: 14 Apr 2016
Posts: 1
surf637 wrote:I am only a
surf637 wrote:
why Calc does not use regular expressions while many programming languages…

Calc can use Regular expressions, but the User can decide to avoid it. One of the Problems – especcially, if you are not used to handle it – is the special meaning of quite often used CHARs like $ () and . in regular expressions.

I often have to search for 5-digit sequences in paranthesis like (12345), where I like to ignore the special meaning of () in regular expressions. Otherwise I´d have to write \(12345\) for the same term.
But sometimes I have to reformat a text and remove every tab before one of these numbers:
Search \t(\([:digit:]{5}\)) and replace by $1

So it is useful to have an option to switch. In search and replace there is a checkbox to do this, and there is also a
general option (per file saved?) to allow these patterns as argument for calc-functions.

To the first question: If Excel is not using the same standard of regexp (and my guess is MS was always inventing own stuff), then it is nearly impossible to convert patterns. So LO-pattern-settings wouldn´t work in excel-files.
Same problem as converting BASIC-Macros…

Joern

LibreOffice 5.1.1

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.