Adriano
Adriano

Reputation: 1723

Does Kusto not support regex lookarounds?

It seems that Kusto doesn't support regex lookarounds, as I get the following errors when I try to run the below commands. Am I using the wrong syntax? If this feature really isn't supported, where can I give feedback to vote for this feature?


Positive Lookahead Test:

print(extract("t(?=t)", 0, "http"))

Expected Output: tt

Actual Error: Relop semantic error: 'extract()' has the following semantic error: SEM0420: Regex pattern is ill-formed: t(?=t).


Negative Lookahead Test:

print(extract("t(?!t)", 0, "http"))

Expected Output: tp

Actual Error: Relop semantic error: 'extract()' has the following semantic error: SEM0420: Regex pattern is ill-formed: t(?!t).

Upvotes: 0

Views: 4573

Answers (1)

Yoni L.
Yoni L.

Reputation: 25895

Kusto uses the re2 library: https://github.com/google/re2/wiki/Syntax, as mentioned here: https://learn.microsoft.com/en-us/azure/kusto/query/re2

What you're trying to achieve isn't supported by that library - see https://github.com/google/re2/wiki/WhyRE2:

As a matter of principle, RE2 does not support constructs for which only backtracking solutions are known to exist. Thus, backreferences and look-around assertions are not supported.

As for your other question, feature requests can be submitted/upvoted @ https://aka.ms/adx.uservoice

Upvotes: 1

Related Questions