parse-community / parse-community/parse-dashboard

Undocumented regexp matching is confusing

Open
#2,153 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type:feature
Dominant language
JavaScript
Stars
3.8k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

New Issue Checklist
Issue Description

"string contains string" actually uses Parse.Query's .matches(str,'i') specifier, which is not documented and can cause problems because various punctuation has special meaning in regexps. However, as regexps are also very useful, it would be best to keep this feature while renaming it "matches" or "matches regexp" or "matches pattern" or "regexp" or "pattern", while also have a separate choice called "contains" or "contains substring", which would match a regexp produced by :

function escapeRegex(s:string):string {
    return s.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&')
}
Steps to reproduce

Filter a string field with a "string contains string" clause (in any version of Dashboard in which it still works, e.g. 4.0.0) ; search using a . in place of any specific character, which will find your items anyway ; then try searching for ( in a string column that has that character : searching for \( finds those items even though no \ is in that column, and searching for literally ( finds 0 results.

Actual Outcome

"string contains string" searches for regexp.

Expected Outcome

"string contains string" would search for a substring, another option would search for provided regexp.

Environment

Dashboard

  • Parse Dashboard version: 4.0.0
  • Browser (Safari, Chrome, Firefox, Edge, etc.): Firefox 100.0.1

Server

  • Parse Server version: 5.2.0
  • Operating system: Heroku-20
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Heroku

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: Unknown
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): ObjectRocket at Heroku

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Dashboard filter control that presents the “string contains string” clause and trace how it builds the Parse.Query condition. Compare the current behavior with the documented matches semantics and the expected literal-substring behavior; done means the UI distinguishes substring and regular-expression searches and punctuation is handled as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.