You are viewing limited content. For full access, please sign in.

Question

Question

Pattern matching to retrieve two specific data

asked on February 12 Show version history

Hello. I have these data below. I need to retrieve the value 2 and aaa in the row number 1.
I need to retrieve the first value and second value for each row when it will be filled. I tried to use "1": \["([^"]+)", "([^"]+)"\] in pattern matching but it is not working Anyone has a solution please?

{
  "1": "[\"2\",\"aaa\"]",
  "2": "[\" \",\" \"]",
  "3": "[\" \",\" \"]",
  "4": "[\" \",\" \"]",
  "5": "[\" \",\" \"]",
  "6": "[\" \",\" \"]",
  "7": "[\" \",\" \"]",
  "8": "[\" \",\" \"]",
  "9": "[\" \",\" \"]",
  "10": "[\" \",\" \"]"
}
 

0 0

Replies

replied on February 12 Show version history

I tried this on regex101.com:

"\d+":\s+"\[\\"(.*)\\",\\"(.*)\\"\]"

   

 

Note: Is this JSON values?  If so, you might be better off using the "Read JSON" activity rather than the "Pattern Matching" activity.

3 0
replied on February 12

My thought would be to use a pattern to split the data into tokens and then run that output through a second pattern to extract the data from the string.

 

0 0
replied on February 12

Okay thanks. I got these values above in a Read Json Activity and break it down in the pattern matching.
The value return as you did is 2aaa. I will try to split the two words with the pattern matching.

0 0
replied on February 13

If     (\d+)\W+(\w*)    Is resulting in 2aaa and you need 2 and aaa separately, you could do two different Pattern Matching tokens:

(\d+)\W+\w*           --Should return 2
\d+\W+(\w*)           --Should return aaa

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.