Skip to content

API queries using a "matches" regular expression filter--need to determine what regex syntax works and what doesn't #5

Description

@jthomale

When using the "matches" filter type in an API query, like this:

http://libuiapp01.library.unt.edu/catalog/api/v1/marc/?010a[matches]=^[0-9]{0,3}$

it isn't always clear what regex syntax is supported. The regular expression is sent to Solr, so ostensibly it should support the same syntax, but sometimes things don't quite work the way I expect. I suspect part of this may be related to issue #3, where things aren't being escaped properly (or are being escaped too many times) before they're sent to Solr. For instance:

http://libuiapp01.library.unt.edu/catalog/api/v1/marc/?010a[matches]=^\d

matches where there is a literal "d" character at the beginning of an 010 subfield a, rather than either matching a digit like [0-9] or throwing an error (or not matching anything).

(This is on my to-do list to look into, but I don't really have many other concrete examples, so I need to get some concrete examples.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions