AEL regcomp error


when running aelparse, I am getting the following error:

LOG: lev:3 file:ast_expr2.y line:1566 func: op_colon regcomp() error : Invalid preceding regular expression

There is no line number for offending line in extensions.ael. Looking at the error message, it appears there is a colon somewhere it shouldn’t be (or there really is an invalid regex), but the file is very large and it’s very difficult to find the error just searching for colons. Is there any way I can get the line number or the expression that regcomp deems invalid?

I figured it out. The following syntax is the culprit:

result="${string}" : "${regex}";

For some reason, parser interprets variable reference ${regex} as the actual regex, instead of ignoring it. So this is a false alarm. It can be avoided by using REGEX function instead of : or =~ operators if possible, otherwise by using Set application.

Whilst it should probably cope, I think the root of the problem is that AEL compiles into something closer to the extensions.conf format, and variable substitution happens at run time.

Sure, but like you said, parser should be able to cope with that. It’s easy to recognize variable reference and replace it with some valid regex, or simply not feed the expression to regcomp.