RegEx alternative to multiple Contains function
- 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 all,
I am trying to find an elegant way to convert multiple Contains function check to a single RegEx_Match function but not able to get good results. Any advise here
!Contains([Description],"trail")
AND
!Contains([Description],"mod")
AND
!Contains([Description],"chg")
Alternate:
REGEX_Match([Description],".*^[(mod),(chg),(trail)].*")
Solved! Go to Solution.
- Labels:
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Try this one instead!
REGEX_Match([Field1],".*trail.*||.*mod.*||.*chg.*")
The || operates as an "or" and looks for anything that contains trail, mod, or chg anywhere in the field (putting the .* on either side allows for other characters before or after the words you're searching for).
Hope that helps!
Cheers,
NJ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Mine is similar to @NicoleJohnson:
!REGEX_Match([Description],".*(mod|chg|trail).*")
You only need a single | for alternatives in REGEX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
A similar post: Using-IN-within-a-Contains-function
@jdunkerley79 and I approached it the same way.
Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you and it worked very elegantly.
Any idea on how to match this string "AC Pur off lse - - AI" with my unsuccessful attempt with REGEX_Match([Description],"^(AC ).*") ?
The following string does gets matched but not the one above.
AC Data Comm - - AIR2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
does this do what you want?
REGEX_Match([Description],"^AC\s.*")
Cheers,
Mark
Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
It worked with a correction that I had to make to another exclusion condition where I had the group match (CAP) typed as [CAP].
Thanks !
