Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#8994 closed enhancement (fixed)

ItemFileReadStore: support for externally created regular expressions

Reported by: craigm Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.4
Component: Data Version: 1.2.3
Keywords: regex regular expression ItemFileReadStore Cc:
Blocked By: Blocking:


This ticket is related to #8237.

The _fetchItems function allows limited regular expression capabilites in the supplied query strings, * and ?. But why not allow full regular expression support? At the moment if you pass in a regular expression containing any other characters than * and ? then they are escaped and will not function as intended (my regexs are built at the server so I have no worries about user input). It seems reasonable to allow RegExp? objects to be used as query values like this:

{attribute1: 'bob', attribute2: new RegExp("[0-9].*")}

and would only require a small change to the function, alter the lines

if(typeof value === "string"){
  regexpList[key] =, ignoreCase);


if(typeof value === "string"){
  regexpList[key] =, ignoreCase);
} else if (value instanceof RegExp) {
  regexpList[key] = value;

In the above mentioned ticket that was marked as nofix, the workaround suggested was to extend the ItemFileReadStore? and override the _fetchItems function. This function is over 100 lines long and throws up lots of red flags at me to think that I would have to copy/paste the entire function to add 2 lines in my override. Another reason for the dismissal of #8237 is that there would be a need to update the documentation for the store. I don't think that the extra documentation for this minor (but extremly useful) enhancement would be so burdensome as to outweight its benefit.

Change History (3)

comment:1 Changed 13 years ago by Jared Jurkiewicz

This patch is more reasonable, with respect to just passing a regexp to the store and it will use it as/is. I like this approach to getting the function you want over the previous suggestion of altering pattern2regexp function, which is intended specifically for handling the simple recommended query syntax.

comment:2 Changed 13 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed

(In [19525]) Minor feature addition. \!strict fixes #8994

comment:3 Changed 13 years ago by Jared Jurkiewicz

Milestone: tbd1.4
Note: See TracTickets for help on using tickets.