Forum Discussion
Need help with Regex
If there can only be a single instance of the account number, then you could keep it simple using
starts with 'o' and does not contain a comma.
If you need to more robustly match your account numbers, then you'd need to be more specific with the rules, but given what you've said already, something like this should work.
^o[a-z]{3}-[0-9A-Z]{8,10}$
Using the start and end of string characters (^ and $) to make sure there was only one instance.
If you had a list of things that should match and things that should not, I can probably better refine what you're looking for.
(and as David said, it's a starting point for a conversation.)
- Rajorigin9 months agoSpecialist
Thank you very much, much appreciated bob , the reegx helps to identify the product in the string, which is great but the challenge when there are multiple products i.e. account numbers listed in the string. Don't think I can use the filter starts with 'o' as the target attribute account_active is a custom attribute and not within a nested object (in which case I could have used multi-criteria segmentation where account_active starts with 'o' AND matches regex ^o[a-z]{3}-[0-9A-Z]{8,10}$
Cheers
Raj
- bob9 months agoSpecialist
Okay, ignore any simple starts-with/contains filters.
I thought you only wanted to match when there was a single identifier in the string, so no multiple values and no comma-separation?"...need only that user that has got only one account starting with "o" and they should not have any other account numbers."
In which case, the ^ at the start will ensure that the following character occurs at the beginning of the string and the $ at the end will ensure that there's nothing after the preceding matched characters - which in this case are specific enough to only match a single account number.
Related Content
- 7 months ago
- 2 years ago
- 27 days ago