Forum Discussion

deepak198486's avatar
deepak198486
Copper Contributor
Apr 23, 2021

i am trying to fetch the machine list which does not contain letter " l " in 8th position.

I am trying to fetch the machine list which does not contain letter " l " in 8th position.

can i use Kusto regex to achieve this. I only see matches regex command.

  • deepak198486's avatar
    deepak198486
    Copper Contributor
    I have the regex which identifies it and get the results but i want the results not matching the regex. Is there any command or function to achieve this
    • JBUB_Accelerynt's avatar
      JBUB_Accelerynt
      Brass Contributor

      deepak198486 

       

      Can you post the complete query? We will be able to help.

       

      Have you tried using the "| where not" xxxxxxx feature?   

      • deepak198486's avatar
        deepak198486
        Copper Contributor
        Thanks
        I used the not operator and it worked.
        Meanwhile below is the query
        SecurityRecommendation
        | where RecommendationName == "Disk encryption should be applied on virtual machines"
        | where RecommendationState in ("NotApplicable", "Unhealthy")
        | extend field = split(AssessedResourceId, '/')
        | extend VM = tostring(field[8])
        | extend resourceGroups = tostring(field[4])
        | extend subscriptions = tostring(field[2])
        | where not(VM matches regex "^.......[l].*") == true
        | project VM, RecommendationDisplayName, resourceGroups, subscriptions, TimeGenerated
        | extend HostCustomEntity = VM

Resources