We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Need help parsing with RegEx

Jake5
8 - Asteroid

I have the attached txt file whereby starting at row 10, I need the value in field 1 to be parsed into two columns: i.e. FUND SELECTION OPTION is the Key value and EXCLUDE is the Value value and so forth.  The expression currently within the attached workflow (Regex tool) was working previously, but then the report format was recently altered and it no longer traps the Value values.  Can someone help me tweak the Regex formula to get this to work?

2 REPLIES 2
Will_Condon
8 - Asteroid

Instead of \s{5,}(.*?)\s{5,}(.*?)\s{5,}.* 

Try this ^(.+?)\s{5,}(.+)$

 

Explanation from the regex101 site.

^ asserts position at start of a line
1st Capturing Group
(.+?)
.
matches any character (except for line terminators)
+? matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
{5,} matches the previous token between 5 and unlimited times, as many times as possible, giving back as needed (greedy)
2nd Capturing Group
(.+)
.
matches any character (except for line terminators)
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
$ asserts position at the end of a line
 
You could also add a record ID for each row per page group and filter on >= 10 if you don't want the header rows.
Jake5
8 - Asteroid

Thanks.  However, that solution didn't seem to do the parsing as was hoped for.  But, I was able to resolve by keeping to my original expression but adding a padright formula beforehand to ensure a min character count per line of 132.  For reference I've reattached a new version of the workflow.  It includes both solutions for comparison purposes.  

Labels
Top Solution Authors