Flagsmith / Flagsmith/flagsmith-engine
REGEX operator only matches characters at the beginning of a string
- Dominant language
- Python
- Stars
- 10
- Forks
- 5
- Avg merge
- 4d 8m
- Merged PRs (30d)
- 3
Description
`REGEX` is [implemented](https://github.com/Flagsmith/flagsmith-engine/blob/0105a9d407abb406b559765f07e7059ad5443924/flag_engine/segments/evaluator.py#L138) using [`Pattern.match`](https://docs.python.org/3.11/library/re.html#re.Pattern.match), which only checks the beginning of the search string:
> If zero or more characters at the beginning of string match this regular expression, return a corresponding Match
This means a regular expression like `world` will not match a trait value of `hello-world`.
We should be using `Pattern.search` instead: https://docs.python.org/3.11/library/re.html#re.Pattern.search
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.