0

I'm struggling to find how to validate a user entered Regex pattern.

The use case here is that the user interfaces allows the user to create rules that merge any incoming Merchants that meet the regex pattern specified in a rule. So the user themselves enter the regex pattern. I hope that makes sense.

merchants = Merchant.objects.filter(name__iregex=merge_rule.pattern)

I get system errors when a bad regex is entered into the rule, so I'd like to validate against these.

rcx935
  • 217
  • 5
  • 15

1 Answers1

0

Found an answer here: Is there a regular expression to detect a valid regular expression?

The answer there probably isn't an answer.

rcx935
  • 217
  • 5
  • 15