Select fields that DO NOT follow regex pattern
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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"
course | Date |
0123 K | 20220525 |
173 | 20210404 |
435 | 20200202 |
MB-1234 | 20190919 |
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!
Solved! Go to Solution.
- Labels:
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@junng @You the filter tool and update the custom filter as
!StartsWith([course], ‘MB’)
AND
!EndsWith([course], ‘K’)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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$’)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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 :)!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
