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.
SOLVED

Using a Field as the Pattern within a REGEX_Match Formula Is Giving Inconsistent Results

taxtechfl
7 - Meteor

Rather than hard-coding the pattern in the REGEX_Match formula I am using the values from a field for the pattern.  In some cases the results are as expected, but in other cases it doesn't show a match when it should.

 

If I take the pattern value from the masking field ([RegEx Expression]) and hard-code the string in the REGEX_Match formula, it gives the right result.  I have provided a sample workflow to demonstrate the issue.

 

In the example WF the field [VAT Reg ID] is being checked to see if it matches the Regular Expression in the [RegEx Expression] field.  For RecordID 3 since it failed the match, I used formulas to hard-code the pattern both with and without the ^ and $ and matches occurred with the manual hard-coded patterns.

 

I also stripped the ^ and $ characters from the masking field in a separate test, but the result using the field instead of hard-coded pattern still failed (that test is not included in the sample WF, however).

 

Is there another way to approach this to test a pattern match for a list of patterns from a file or is there something I can do to get this to produce the correct results in all cases?  Thank you for any assistance with this.

2 REPLIES 2
SPetrie
13 - Pulsar

Try it without the single quotes around your expressions in the Regex Expression column.

regex.PNG

taxtechfl
7 - Meteor

Thank you, @SPetrie .  That worked.  Since the formula requires the single quotes in it when hard-coding the pattern, I incorrectly assumed they had to be present in the value passed as the pattern.  Once I removed the single quotes from the value in the field, all results are now consistent and correct.

Labels
Top Solution Authors