Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Select fields that DO NOT follow regex pattern

junng
5 - Atom

Hello everyone,

 

I'm new to the community here and have a not-so-smart question. I am having a problem filtering only records that do not contain specific characters. For example, in the course field , I want to only choose records that DO NOT end with "K" and DO NOT start with "MB" 

courseDate
0123 K20220525
17320210404
43520200202
MB-123420190919

 

I am trying with NOT REGEX_Match([course], "*K") AND NOT REGEX_Match([course], "MB*") but results such as "0123 K" and "MB-1234" still show up. Any inputs are very much appreciated. Hope you all have a nice day!

5 REPLIES 5
binuacs
20 - Arcturus

@junng @You the filter tool and update the custom filter as 

 

!StartsWith([course], ‘MB’)

AND

!EndsWith([course], ‘K’)

DataNath
17 - Castor

Hey @junng! If you're just checking the starts/ends, then would this not work for you? If you have any additional, more detailed conditions you may want to apply then it may be worth going down the route of RegEx matches etc, but for the scenario/conditions above, this should work:

 

DataNath_0-1653472856027.png

 

binuacs
20 - Arcturus

@junng if you are looking for the Regex then update the filter tool custom condition as below 

 

 

!REGEX_match[course], ‘^MB.*’)

AND

!REGEX_match[course], ‘.*K$’)

junng
5 - Atom

Thank you everyone for the support! I need to cross out other patterns and not just at the beginning or end of line so Regex works best in that sense. Have a nice day :)! 

DataNath
17 - Castor

@junng, the RegEx above acts the exact same as the original solutions that were provided without RegEx. The ^ in ^MB.* just means 'line starts with' and the $ in K$ just means 'line ends with' and so there's no difference - these are just the coded equivalents of using Startswith() and Endswith(). If you need a truly dynamic solution based on patterns in the field then we'll need a list of different combinations/possibilities and expected outcomes based on what you need to filter out.

Labels