Raghav
Raghav

Reputation: 3058

Kusto extract text between string

Am trying to use regex to extract a string between a set of strings. But Kusto complains about the regex expression as invalid.

Am trying to replicate the expression from this link in my kusto query.

traces
| where ....
| project  extract_all(@"(?<=This is)(.*)(?=sentence)", message)

Kusto would complain this error..

Relop semantic error: 'extractall' has the following semantic error: SEM0420: Regex pattern is ill-formed: (?<=This is)(.*)(?=sentence).
If issue persists, please open a support ticket. Request id: 01b819be-2e11-4983-9312-30f946c07afb

Could someone please help me fix the syntax of the above regex for kusto?

Upvotes: 1

Views: 7264

Answers (1)

Yoni L.
Yoni L.

Reputation: 25895

as the error message suggests, the regular expression you're specifying as the argument to the extract_all() method is invalid.

from the documentation: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/re2

The regular expression syntax supported by Kusto is that of the re2 library.

If you were to provide a sample input and the matching expected output, it'd be easier to provide you with a functional and efficient solution.

Upvotes: 1

Related Questions