Search code examples
regexp-replaceazure-data-explorerkql

Replacing GUID in Kusto


How can I replace all GUID's in a Kusto query with no value.

e.g.

my data looks like

/page/1d58e797-a905-403f-ebd9-27ccf3f1d2cd/user/4d58e797-a905-403f-ebd9-27ccf3f1d2c3

and I want

/page//user/


Solution

  • You can use the replace function. Also, you can test regular expression here.

    let input = '/page/1d58e797-a905-403f-ebd9-27ccf3f1d2cd/user/4d58e797-a905-403f-ebd9-27ccf3f1d2c3';
    let rx = '[({]?[a-fA-F0-9]{8}[-]?([a-fA-F0-9]{4}[-]?){3}[a-fA-F0-9]{12}[})]?';
    print replace(rx, '', input);