Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Grab Characters to the right of a string

kayla_o
7 - Meteor

Hi all, 

 

I have multiple cells with something like this:      "summar":"null":"score":"SV_0832dmn83bf","project","catalog":

 

I am trying to parse out just this into a separate column: SV_0832dmn83bf

How can I do this?

 

thanks!

4 REPLIES 4
Qiu
21 - Polaris
21 - Polaris

@kayla_o 
What is the cretiria of parse out "SV_0832dmn83bf"?
Maybe you can share a sample input file and desired output with more sample data?

caltang
17 - Castor
17 - Castor

As @Qiu pointed out, we will need more data in order to give you a more robust and dynamic solution. Just with 1 sample row, I can generate the following:

 

image.png

 

.*"score":"([^"]+).*

 

Regex with the above, and replace with \1 will get you your data. But I must stress that this works because I have only seen 1 row of data. Regex is pattern based, so if you give more data, the pattern will be spotted more effectively by regex.

 

Hope this helps. 

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
AmitMiller
Alteryx
Alteryx

I think @caltang's Regex is as good as it gets.

 

Just to clarify the Regex's purpose:

  • It starts by matching any characters that appear before "score":".
  • Then it captures the value of the "score" field (i.e., the characters that are not double quotes).
  • Finally, it matches any remaining characters after the "score" value.

In simpler terms, this expression looks for a piece of text that includes the phrase 'score' followed by a colon and a value enclosed in double quotes. It captures that value, which could be any sequence of characters except another double quote. Then the \1 references that capture group.

 

There are ways to solve this that don't involve Regex - but are much longer. (i.e., split by Colon, then split again by Comma, then remove double-quotes...)

caltang
17 - Castor
17 - Castor

@AmitMiller wrote:

I think @caltang's Regex is as good as it gets.


Never thought I'd see the day... my Regex is horrible. But thanks to Regex101 and online resources + AI, I learned a great deal! Thanks @AmitMiller 

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Labels
Top Solution Authors