You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2014/05/22 07:32:42 UTC

[Issue 124957] New: problem with BD instruction

https://issues.apache.org/ooo/show_bug.cgi?id=124957

          Issue ID: 124957
        Issue Type: DEFECT
           Summary: problem with BD instruction
           Product: Calc
           Version: 4.1.0
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: programming
          Assignee: issues@openoffice.apache.org
          Reporter: lpadumorvan@free.fr

Created attachment 83445
  --> https://issues.apache.org/ooo/attachment.cgi?id=83445&action=edit
file with described problem

If in the mask for field "Name", I use 2 criteria ">=B.*" and "<=D.*" only the
record with Name begining with B.* and C.* are counted (Name begining with D.*
are forgotten).

Thanks

-- 
You are receiving this mail because:
You are the assignee for the issue.
You are watching all issue changes.

[Issue 124957] regular expression for <= and => don't work as expected if string contains placeholders (.*)

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=124957

Rainer Bielefeld <ra...@bielefeldundbuss.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|regular expression for <=   |regular expression for <=
                   |doesn't work as expected if |and => don't work as
                   |string contains             |expected if string contains
                   |placeholders (.*)           |placeholders (.*)

-- 
You are receiving this mail because:
You are the assignee for the issue.
You are watching all issue changes.

[Issue 124957] regular expression for <= doesn't work as expected if string contains placeholders (.*)

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=124957

Rainer Bielefeld <ra...@bielefeldundbuss.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rainerbielefeld_ooo_qa@biel
                   |                            |efeldundbuss.de

--- Comment #2 from Rainer Bielefeld <ra...@bielefeldundbuss.de> ---
Created attachment 83448
  --> https://issues.apache.org/ooo/attachment.cgi?id=83448&action=edit
New Sample Document

I think there is a more simple summary of results of comment 1:

A hit for "=" should also be a hit for "<=" and ">=", if not that is a mistake

In sample document "c" and "cword" will be found for "=  c.*". So I consider
current behavior where "c" is missing for  ">=  c.*" and "cword" is missing for
"<=  c.*"

Additional Info:
----------------
(a) On the other hand there seems to be a little logic in the results, 
    I will have to think about that.
(b) Same behavior with KingSoft Spreadsheet, Gnumeric, Softmaker FreeOffice

@mroe
" ... the expression x.* and a defined string Xstring is defined ..."
Is that based on your tests or written in a regular expressions manual?

-- 
You are receiving this mail because:
You are the assignee for the issue.
You are watching all issue changes.

[Issue 124957] regular expression for <= doesn't work as expected if string contains placeholders (.*)

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=124957

mroe <mr...@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|4.1.0                       |OOo 3.3 or older
            Summary|problem with BD instruction |regular expression for <=
                   |                            |doesn't work as expected if
                   |                            |string contains
                   |                            |placeholders (.*)

--- Comment #1 from mroe <mr...@gmx.net> ---
I can reproduce the behaviour but I don't know if there is a bug.
There is a logical problem with the expression.

Let X be a defined number or a defined string. Then it is valid:

(X < X) = FALSE
(X = X) = TRUE
(X > X) = FALSE

(Y < X) = NOT (Y = X) AND NOT (Y > X) = NOT ((Y = X) OR (Y > X))
(Y <= X) = (Y < X) OR (Y = X) = NOT (Y > X)

If NOT (Y > X) THEN (Y <= X)

But for the expression x.* and a defined string Xstring is defined

(Xstring < X.*) = FALSE
(Xstring = X.*) = TRUE
(Xstring > X.*) = TRUE

Now we have the logical problem that

(Xstring < X.*) OR (Xstring = X.*) = TRUE
BUT
NOT (Xstring > X.*) = FALSE


@reporter:
You can solve your problem using a separate OR condition:
Name    Name
>=b.*	<d.*
    =d.*
condition area: A9:B10

-- 
You are receiving this mail because:
You are the assignee for the issue.
You are watching all issue changes.

[Issue 124957] regular expression for <= and => don't work as expected if string contains placeholders (.*)

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=124957

mroe <mr...@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Issue Type|DEFECT                      |ENHANCEMENT

--- Comment #4 from mroe <mr...@gmx.net> ---
(In reply to hdu@apache.org from comment #3)
> I'm no calc expert but the behaviour suggests that there is a bug when it is
> determined whether a literal or a regexp comparison should be done between
> the strings. In literal comparison "dword<=d.*" is false, because the
> codepoint of 'w' is bigger than the codepoint of a dot. Only for the
> equality-check the regexp seems to be active...

Ahh. That's why the option explicitly says:
"Search criteria = and <> must apply to whole cells" (to make it compatible to
Excel).

This explains my observations stated in comment 1 in an other way:

For the expression X.* and a defined string Xstring the result will be

(Xstring <X.*) = (Xstring < "X.*") = FALSE (non regexp)
(Xstring =X.*) = ((MIN(X.*) <= Xstring <= MAX(X.*)) = TRUE (regexp)
(Xstring >X.*) = (Xstring > "X.*") = TRUE (non regexp)

Thank you!

For reporters problem the easiest solution is
without regexp:
|Name    |Name
|>=b    |<e
condition area: A9:B10

with regexp:
|Name
|=^[b-d].*
condition area: A9:A10

I think < and > with regexp isn't meaningful, because there IS a pattern match
or IS NOT.

What would be the "right" solution for [3-7] > 5?
(Is 5 greater than 3 to 7 or not?)

So I suggest to close this issue as NOT AN ISSUE.

-- 
You are receiving this mail because:
You are the assignee for the issue.
You are watching all issue changes.

[Issue 124957] regular expression for <= and => don't work as expected if string contains placeholders (.*)

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=124957

hdu@apache.org <hd...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |CONFIRMED
                 CC|                            |hdu@apache.org
     Ever confirmed|0                           |1

--- Comment #3 from hdu@apache.org <hd...@apache.org> ---
I'm no calc expert but the behaviour suggests that there is a bug when it is
determined whether a literal or a regexp comparison should be done between the
strings. In literal comparison "dword<=d.*" is false, because the codepoint of
'w' is bigger than the codepoint of a dot. Only for the equality-check the
regexp seems to be active...

I'm sorry that I currently can't spend more time on this but for volunteers
here is a code pointer: main/sc/source/core/tool/interpr1.cxx

-- 
You are receiving this mail because:
You are the assignee for the issue.
You are watching all issue changes.

[Issue 124957] regular expression for <= and => don't work as expected if string contains placeholders (.*)

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=124957

hdu@apache.org <hd...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CONFIRMED                   |RESOLVED
         Resolution|---                         |NOT_AN_ISSUE

--- Comment #5 from hdu@apache.org <hd...@apache.org> ---
> I think < and > with regexp isn't meaningful, because there IS a pattern
> match or IS NOT.

Agreed. The actual behavior is still a bit surprising because of the seemingly
gratuitous switch between literal-mode and regexp-mode. Maybe Calc should
somehow warn about this.

> What would be the "right" solution for [3-7] > 5?
> (Is 5 greater than 3 to 7 or not?)

That comparison doesn't make sense to me. [3-5]>5 would be false and [6-7]>5
would be true, so the end-result would depend on whether these partial results
were ORed or ANDed. Better do the checks individually and combine them as
desired.

> So I suggest to close this issue as NOT AN ISSUE.

Done.

-- 
You are receiving this mail because:
You are the assignee for the issue.
You are watching all issue changes.