Build, test, and debug regular expressions
This regular expression validates user-defined logical evaluation conditions consisting of numbers separated by 'AND' or 'OR' operators. It handles variations like expressions with or without enclosing parentheses, and potentially trailing characters. It is useful in rule engines or form validation where logical sequences of numeric IDs are evaluated.