[Libreoffice-bugs] [Bug 126764] New: REGEX() function with an integer as 'Occurence' returns the complete 'Text' if the respective match doesn't exist. It should return #N/A.

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Aug 8 09:51:17 UTC 2019


https://bugs.documentfoundation.org/show_bug.cgi?id=126764

            Bug ID: 126764
           Summary: REGEX() function with an integer as 'Occurence'
                    returns the complete 'Text' if the respective match
                    doesn't exist. It should return #N/A.
           Product: LibreOffice
           Version: 6.3.0.2 rc
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: jag at psilosoph.de

To justify my choice of "major" for severity see last paragraph!

Example

Current behaviour:
=REGEX("12-34-56";"[^-]*-";"";3) returns "12-34-56".

Expected behaviour and reasons:
#N/A should be returned.
Since the ordered replacement couldn't be performed due to the lack of a third
match, the actual behaviour is gravely misleading. 

Additional explanations:
Some real applications will need much more complicated formulae to get a
workaround under the current behaviour.
In an actual use-case I need to rely on something like
=LEFT(REGEX($A9;$E$2;"";1);IF(CURRENT()=$A9;0;1)) instead of the clear and
simple
=IFNA(LEFT(REGEX($A9;$E$2;"";1);1);"")

In more complicated cases it may get difficult if not impossible to catch the
error without helper cells and without relying on functions (SEARCH()
e.g.)capable of applying RegEx ONLY IF the respective global setting is
enabled.

[I do not know how google sheets do whatever concerning REGEX(). Again a case
where conflicts concerning quality vs compatibility may occur. I would
appreciate quality higher generally.]

Since the REGEX() function was only implemented recently (V6.1) it may still be
feasible to change that without endangering the functionality of currently
working sheets. therefore a fix should be created REALLY FAST.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190808/8ad85873/attachment.html>


More information about the Libreoffice-bugs mailing list