Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wildcards (? and *) support #220

Closed
wojciechczerniak opened this issue Feb 28, 2020 · 11 comments
Closed

Wildcards (? and *) support #220

wojciechczerniak opened this issue Feb 28, 2020 · 11 comments
Assignees
Labels
Feature Something we can add later on without introducing a breaking change Function Feature or bug in formula function
Milestone

Comments

@wojciechczerniak
Copy link
Contributor

wojciechczerniak commented Feb 28, 2020

Description

ODFF specifies wildcards in their global (evaluator) settings: #58

HOST-USE-WILDCARDS: If true, wildcards question mark '?' and asterisk '*' are used for character-string comparisons and when searching. Wildcards may be escaped with a tilde '~' character.

Related functions

All database functions: DAVERAGE, DCOUNT, DCOUNTA, DGET, DMAX, DMIN, DPRODUCT, DSTDEV, DSTDEVP, DSUM, DVAR, DVARP

The results of database functions may change when the values of the HOST-USE-REGULAR-EXPRESSIONS or HOST-USE-WILDCARDS or HOST-SEARCH-CRITERIA-MUST-APPLY-TO-WHOLE-CELL properties change. 3.4

Then this depends on the function description, but we can extract the list: COUNTIF, COUNTIFS, HLOOKUP, LOOKUP, MATCH, VLOOKUP, SUMIF, SUMIFS, AVERAGEIF, AVERAGEIFS, FIND, SEARCH.

All of them has short note:

The values returned may vary depending upon the HOST-USE-REGULAR-EXPRESSIONS or HOST-USE-WILDCARDS or HOST-SEARCH-CRITERIA-MUST-APPLY-TO-WHOLE-CELL properties. 3.4

Links

http://help.grapecity.com/spread/SpreadSheets12/webframe.html#wildcard.html

@wojciechczerniak wojciechczerniak added Feature Something we can add later on without introducing a breaking change Function Feature or bug in formula function labels Feb 28, 2020
@wojciechczerniak wojciechczerniak added this to the March 2020 milestone Feb 28, 2020
@wojciechczerniak wojciechczerniak mentioned this issue Feb 28, 2020
89 tasks
This was referenced Mar 16, 2020
@wojciechczerniak wojciechczerniak modified the milestones: April 2020, Next Apr 6, 2020
@wojciechczerniak
Copy link
Contributor Author

useWildcards in global config. Performance may be lower, so this should be disabled by default.

@izulin
Copy link
Collaborator

izulin commented Apr 13, 2020

@wojciechczerniak

what exactly can be in the pattern (with and without the flag for wildcards?)

@wojciechczerniak
Copy link
Contributor Author

@izulin What do you mean? There are three special characters introduced asterisk: "*", quotation mark: "?" and the tilde: "~". Without the flag, they are considered as any other character.

When it comes to the use cases, there are multiple sources all over the internet. Some are simple, some pretty advanced:

https://www.excelawesome.com/12-excel-wildcard-examples-you-need-to-know/
https://exceljet.net/glossary/wildcard
https://softwareaccountant.com/vlookup-wildcard/
https://www.spreadsheetweb.com/wildcard-in-excel-formula/
https://www.spreadsheetweb.com/excel-wildcard-criteria/
https://help.grapecity.com/spread/SpreadSheets12/webframe.html#wildcard.html

@izulin
Copy link
Collaborator

izulin commented Apr 14, 2020

@izulin What do you mean? There are three special characters introduced asterisk: "*", quotation mark: "?" and the tilde: "~". Without the flag, they are considered as any other character.

When it comes to the use cases, there are multiple sources all over the internet. Some are simple, some pretty advanced:

https://www.excelawesome.com/12-excel-wildcard-examples-you-need-to-know/
https://exceljet.net/glossary/wildcard
https://softwareaccountant.com/vlookup-wildcard/
https://www.spreadsheetweb.com/wildcard-in-excel-formula/
https://www.spreadsheetweb.com/excel-wildcard-criteria/
https://help.grapecity.com/spread/SpreadSheets12/webframe.html#wildcard.html

Do we need the flag? There is no such flag in EXCEL/GS, right?

@wojciechczerniak
Copy link
Contributor Author

The flag is a part of ODFF spec.

LC has it:
Screenshot 2020-04-14 at 15 32 11

@izulin
Copy link
Collaborator

izulin commented Apr 14, 2020

ok

@wojciechczerniak
Copy link
Contributor Author

@izulin There are two additional flags that may be related:

HOST-SEARCH-CRITERIA-MUST-APPLY-TO-WHOLE-CELL If true, the specified search criteria shall apply to the entire cell contents if it is a text match using = or <>; if not, only a subpart of the cell content needs to match the text.

HOST-USE-REGULAR-EXPRESSIONS: If true, regular expressions are used for character string comparisons and when searching.

What if underneath it's always a Regexp?

  • If HOST-SEARCH-CRITERIA-MUST-APPLY-TO-WHOLE-CELL is true then that is a strict match
  • If HOST-SEARCH-CRITERIA-MUST-APPLY-TO-WHOLE-CELL is false we're searching for any match
  • If HOST-USE-REGULAR-EXPRESSIONS is enabled we use any Regexp available
  • If HOST-USE-WILDCARDS is enabled we limit the Regexp to * and ?

@izulin
Copy link
Collaborator

izulin commented Apr 14, 2020

@wojciechczerniak one last question: what happens, if we improperly use '~' for escaping?
e.g. pattern being only '~' , or escape something that does not need escaping?

@izulin
Copy link
Collaborator

izulin commented Apr 14, 2020

@wojciechczerniak
what happens to caseSensitivity/accentSensitivity?

@wojciechczerniak
Copy link
Contributor Author

@wojciechczerniak one last question: what happens, if we improperly use '' for escaping?
e.g. pattern being only '
' , or escape something that does not need escaping?

Escaped character is still that character.

@wojciechczerniak
what happens to caseSensitivity/accentSensitivity?

Comparison operators are subjected to caseSensitive config option. When it comes to functions, each has its own constraints. f.e. MATCH: "If a match is found, MATCH returns the relative position (starting from 1). For Text the comparison is case-insensitive."

AccentSensitivity is not mentioned within ODFF. Looks like the culture settings are global and IMO is a good rule of thumb.

@izulin izulin mentioned this issue Apr 17, 2020
7 tasks
@wojciechczerniak
Copy link
Contributor Author

Done in #303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Something we can add later on without introducing a breaking change Function Feature or bug in formula function
Projects
None yet
Development

No branches or pull requests

3 participants