Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

RegEx: Get Repeated Parse Matches

Billbisco
7 - Meteor

I have multiple fields where I have text between tags that I want.  For Example: 

 

 

<span style="font-size&#58;10.66px;">e</span><span style="font-size&#58;10.66px;">nhancement for existing report</span>

The Result I want to get is

 

 

 

enhancement for existing report

 

The below code works except that it only delivers the first match: 

 

 

<span.*?>\K(.*?)(?=<\/span>)

 

 

Searching online, it seems that adding a  /g   to the end should deliver me multiple matches but I cannot get it to work in Alteryx, even though it seems to work here

 

Any help would be appreciated

4 REPLIES 4
JoshKushner
12 - Quasar

Hi @Billbisco, if you 'tokenize' your result you will get all regex parses. From there you can cross tab your data and combine it with a formula tool.

 

Workflow

Workflow.PNG

 

Regex

regex.PNG

 

Output

result.PNG

 

 

estherb47
15 - Aurora
15 - Aurora

Hi

Have you considered a formula tool? Or Multi-field formula if you need to apply across several columns?

The Regex_Replace function can replace anything within the <> with nothing:

REGEX_Replace([Field1], "(<.*?>)", "")
image.png

JoshKushner
12 - Quasar

Here is the cross tab and formula

 

Workflow

workflow crosstab.PNG

 

Crosstab

crosstab.PNG

 

Output

result crosstab.PNG

Billbisco
7 - Meteor

Thank you Josh and Esther for your quick replies.

 

You're right Josh that I could tokenize it and then combine later.  Alteryx seems to not allow it to dynamically create columns as needed.  Afterall, there could be more than 2 span style tags.  Crosstab I will have to look into for future applications thanks!

 

Esther, your formula works quite well.  I'm somewhat disappointed I can't use straight up Regex with /g at the end though.  But, this is elegant and in one step and I'll use it.  Thanks!

Labels