my $operand = '[a-zA-Z0-9_]+' ; my $re = qr{ \A # Beginning of line \s* # Optional whitespace ($operand) # Capture(1) Alphanumeric LHS \s* # Optional whitespace ( # Capture(2) either: [<>!]= # <=, >=, != | [<>=] # <, >, = ) \s* # Optional whitespace ($operand) # Capture(3) Alphanumeric LHS }x;