Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.

Alteryx Designer Desktop Discussions

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

Select fields that DO NOT follow regex pattern

junng
Átomo

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 RESPUESTAS 5
binuacs
Arturo

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

 

!StartsWith([course], ‘MB’)

AND

!EndsWith([course], ‘K’)

DataNath
Cástor

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
Arturo

@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
Átomo

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
Cástor

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

Etiquetas