find the number of inner elements from parse string


1 comment

  • Avatar
    Monty Yao

    You could parse out the elements within choco with regex multi, then count how many time it shows. For example:


    | parse "*:[*]" as name,elements
    | extract field=inner "(?<comma>\,+?)" multi  // extract the comma characters
    | count name  // this count how many time choco shows up 
    | _count+1 as num_elements  // add one because number of elements is one more than number of commas

    Comment actions Permalink

Please sign in to leave a comment.