Skip to content

docs: clarify supported regular expression syntax, scope, and anchor behavior - #4924

Open
basisworks wants to merge 1 commit into
JanusGraph:masterfrom
basisworks:docs-regex-syntax-and-behavior
Open

docs: clarify supported regular expression syntax, scope, and anchor behavior#4924
basisworks wants to merge 1 commit into
JanusGraph:masterfrom
basisworks:docs-regex-syntax-and-behavior

Conversation

@basisworks

Copy link
Copy Markdown

Fixes #1377.

What changed

Adds a dedicated section Regular Expression Syntax and Behavior to docs/index-backend/text-search.md:

  1. Engine & Syntax: Documents that JanusGraph's indexing backends (Elasticsearch, Lucene, Solr) process regex queries using Lucene's regular expression engine, with direct links to the official Elasticsearch & Lucene regex syntax specs.
  2. Matching Scope: Clarifies the core difference between full-text regex (textContainsRegex) and string regex (textRegex):
    • textContainsRegex: Evaluates against individual tokens. Anchors (^ and $) match individual token start/end, which explains why queries like textContainsRegex('^loves') act as token prefix matches rather than matching the start of the whole property string.
    • textRegex: Evaluates against the entire un-tokenized string (Mapping.STRING). Note that Lucene implicitly anchors regex queries to full terms.

Docs update only — no code changes.

…behavior

Document that text search regular expressions use Lucene's regular expression
engine (via Elasticsearch/Lucene/Solr backends). Clarify how textContainsRegex
evaluates against individual tokens (where anchors match token boundaries)
versus textRegex evaluating against full un-tokenized strings.

Fixes JanusGraph#1377

Signed-off-by: basisworks <basisworfks.dev@gmail.com>
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

@porunov porunov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you @basisworks !
Merging with CTR

@porunov

porunov commented Aug 5, 2026

Copy link
Copy Markdown
Member

@basisworks before we merge it, could you please sign your commit according to EastCLA? Thanks!
#4924 (comment)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document supported regular expressions

2 participants