Forum Discussion
Need help with Regex
Hey Rajorigin
I think I understand your need and my regex is not amazing but this might help get the conversation started.
o[a-z]{3,4}-\d{1,2}
Where 'o' is the lower case 'o', '[a-z]{3,4}' is looking for any sequence of 3 to 4 lowercase letters after the 'o' as it appears some users may have 3 and some may have 4. The '-' is just that, and the '\d{1, 2}' is looking for any one or two digit numbers on the end, as it looks like they could have 8, or 10 or probably other numbers.
So, you know, I built this by putting your question into CoPilot, which got me 95% there and then used Regex101 to test and debug what CoPilot gave me with your strings.
😊
- Rajorigin10 months agoSpecialist
Hello David,
Thanks for the revert much appreciated. I tried similar regex before, and it worked. But in my specific used case I need only that user that has got only one account starting with "o" and they should not have any other account numbers. For example, the custom attribute will have values like A-123456, oxxx-AB12345689. I do not want this customer because they have another account starting with A. If there is a filter condition "does not matchregex" that would have been easier, but I can't see that.
Cheers/ Raj
- DavidO10 months agoStrategist II
Hmm, yeah that's a trickier one for sure. I know you can use regex to reject or match certain values, positive and negative lookahead, but my knowledge of it would be limited at best. It might be worth investigating.
Related Content
- 8 months ago
- 2 years ago
- 3 months ago