apache / apache/lucene

REGEX Pattern Search, character classes with quantifiers do not work [LUCENE-9718]

Open
#10,757 4 comments 0 reactions 0 assignees View on GitHub
affects-version:7.7.3 affects-version:8.6.3 legacy-jira-label:documentation legacy-jira-label:RegEx legacy-jira-priority:Minor module:core/search type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Character classes with a quantifier do not work, no error is given and no results are returned. For example \d\{2} or \d\{2,3} as is commonly written in most languages supporting regular expressions, simply and quietly does not work.  A user work around is to write them fully out such as \d\d or [0-9][0-9] or as [0-9]\{2,3} .

 

This inconsistency or limitation is not documented, wasting the time of users as they have to figure this out themselves. I believe this inconsistency should be clearly documented and an effort to fixing the inconsistency would improve pattern searching.

---
Migrated from [LUCENE-9718](https://issues.apache.org/jira/browse/LUCENE-9718) by Brian Feldman (@bgfeldm), updated Feb 02 2021

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by locating Lucene's regex pattern search implementation and reproduce the \d{2} and \d{2,3} examples, then compare them with the documented workaround forms. Determine whether the completed work should document the limitation, change pattern handling, or both, and add coverage for the chosen behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.