--- title: Regex Phrase --- ## Basic Usage `regex_phrase` matches a specific sequence of regex queries. It is similar to `phrase` but allows for more flexibility in the query. ```sql Function Syntax SELECT description, rating, category FROM mock_items WHERE id @@@ paradedb.regex_phrase('description', ARRAY['.*nning', '.*oes']); ``` ```sql JSON Syntax SELECT description, rating, category FROM mock_items WHERE id @@@ '{ "regex_phrase": { "field": "description", "regexes": [".*nning", ".*oes"] } }'::jsonb; ```
Specifies the field within the document to search for the term. An `ARRAY` of regex queries that the search is looking to match. A slop of `0` requires the terms to appear exactly as they are in the phrase and adjacent to each other. Higher slop values allow for more distance between the terms. Limits the number of term variations that the prefix can expand to during the search. This helps in controlling the breadth of the search by setting a cap on how many different terms the prefix can match. Setting slop equal to `n` allows `n` terms to come in between the terms in the phrase. ```sql Function Syntax SELECT description, rating, category FROM mock_items WHERE id @@@ paradedb.regex_phrase('description', ARRAY['.*eek', 'shoes'], slop => 1, max_expansion => 10); ``` ```sql JSON Syntax SELECT description, rating, category FROM mock_items WHERE id @@@ '{ "regex_phrase": { "field": "description", "regexes": [".*eek", "shoes"], "slop": 1, "max_expansion": 10 } }'::jsonb; ```