Flagsmith / Flagsmith/flagsmith-engine

REGEX operator only matches characters at the beginning of a string

Aperta
#207 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
10
Fork
5
Merge medio
4g 8m
PR unite (30g)
3

Descrizione

`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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Apri flag_engine/segments/evaluator.py all’implementazione REGEX collegata e leggi la documentazione di Python su Pattern.match e Pattern.search. Riproduci il caso hello-world/world segnalato e verifica che l’operatore REGEX corrisponda alla sottostringa come richiesto, preservando al contempo il comportamento previsto all’inizio della stringa.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
backend
Tipo di issue
Bug
Difficoltà
1/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.