Oct 11 2019
02:48 PM
- last edited on
Apr 08 2022
10:09 AM
by
TechCommunityAP
Oct 11 2019
02:48 PM
- last edited on
Apr 08 2022
10:09 AM
by
TechCommunityAP
I am trying to get the 2 matches found at the beginning of the string. According to this page, you can use \A to match beginning of the line. The re2 engine syntax also permits ^ to assert position to beginning of string.
In this case I want the first 2 <Param>value</Param>. The expected return value is ["a","b"] but instead the return is [["a","b"],["c","d"]]
print extract_all("^<Param>([^<]*)</Param><Param>([^<]*)</Param>", "<Param>a</Param><Param>b</Param><Param>c</Param><Param>d</Param><Param>e</Param>")
print extract_all("\\A<Param>([^<]*)</Param><Param>([^<]*)</Param>", "<Param>a</Param><Param>b</Param><Param>c</Param><Param>d</Param><Param>e</Param>")
I know you could use the parse operator, but in this case I need to specify a regex.
Oct 13 2019 11:42 AM
How about?
print Id="<Param>a</Param><Param>b</Param><Param>c</Param><Param>d</Param><Param>e</Param>"
| extend rawExtract = extract_all(@"^<Param>([^<]*)</Param><Param>([^<]*)</Param>", dynamic([1,2]), Id)
| extend returnFirst = rawExtract[0]
Oct 24 2019 12:21 PM