【问题标题】:Extract following word after match word in Kusto在 Kusto 中匹配单词后提取以下单词
【发布时间】:2021-12-30 10:39:00
【问题描述】:

Kusto 使用 re2 库:https://github.com/google/re2/wiki/Syntax,如此处所述:https://docs.microsoft.com/en-us/azure/kusto/query/re2 因此显然不支持环视。

示例字符串:一些句子。一些词 一些词 ServiceInstanceId:78d61d2f-6df9-4ba4-a192-0713d3cd8a82.1234 未找到。 , ErrorCode:2 一些句子。一些句子。一些句子。

是否可以从 Kusto 中的上述字符串中提取 78d61d2f-6df9-4ba4-a192-0713d3cd8a82。需要 "ServiceInstanceId:" 之后的所有字符,直到下一个空格。

【问题讨论】:

    标签: parsing text kql kusto-explorer


    【解决方案1】:

    你可以使用parse:

    let MyTable = datatable(s:string) [
        "Sample String:Some sentence. Some word Some word ServiceInstanceId:78d61d2f-6df9-4ba4-a192-0713d3cd8a82.1234 not found. , ErrorCode:2 Some sentences. Some sentences.Some sentences."
    ];
    MyTable
    | parse s with * "ServiceInstanceId:" ServiceInstanceId " " *
    

    结果:

    s ServiceInstanceId
    Sample String:Some sentence. Some word Some word ServiceInstanceId:78d61d2f-6df9-4ba4-a192-0713d3cd8a82.1234 not found. , ErrorCode:2 Some sentences. Some sentences.Some sentences. 78d61d2f-6df9-4ba4-a192-0713d3cd8a82.1234

    注意:您要求提取到下一个空格,因此答案应该是“78d61d2f-6df9-4ba4-a192-0713d3cd8a82.1234”而不仅仅是“78d61d2f-6df9-4ba4-a192-0713d3cd8a82”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-28
      • 2021-08-01
      • 1970-01-01
      • 2014-10-02
      • 2017-10-09
      • 2013-09-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多