Regex to filter alphanumeric combinations
- 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
Hi,
I am looking to filter out items not matching the requirements. I'm looking to keep items containing letters, numbers and special characters, it can be different combinations and I am struggling to get on regex code to match them all (or a simpler way to do it). If any help, each item will always be 3 characters or more.
Example what to keep/filter out:
abc123 (Letters and Numbers in any order = KEEP)
123456 (All numbers = KEEP)
abc-123 (Letters, special character, number in any order, length and any special character = KEEP)
abcdef (All Letters = OUT)
abc-efd (All letters and special characters in any order = OUT)
Hope this makes sense and thank you in advance
Solved! Go to Solution.
- Labels:
- Custom Tools
- Developer Tools
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@dougejm I'm a little confused by the logic here. In your explanation you say 'filter out items containing letters, numbers and special characters', but in example 3, this is exactly that and you say it should be kept? From your examples, it looks like you want to filter anything where there aren't any numbers present - is that right? If that's the case then you can use a filter like so which just checks whether there's 1 (or more) occurrence of a digit:
REGEX_CountMatches([Input], '\d') > 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi yes, apologies I'm using different/wrong wording. In the text I meant filter out as keep as in filtering through the filter and be kept. Sorry that is very confusing of me. Trying to find a way to change the text/question but not able to find it.
The example is the right way what to keep/not to keep.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
No problem @dougejm. I made an edit to my post which might've been as you were replying - would that filter handle your request or are some records still getting through that you need removing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Worked like a charm, thank you! I have marked it as the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
Can someone help me to build the regex to filter out non alphabets and non numbers as well special characters?
So here is the rule : According to the rule, it means you can have numbers and/or alphabets. You can't have anything else. Nulls can be ignored here
1234 - Keep
ab123 - keep
abcd - keep
anything which doesn't have these combination should be filtered out using the regex
