Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Classification rule builder - create buckets for the values

Avatar

Level 2

The values are storing in eVar, we have to group / buckets the values. I think the best way is to do classification rule builder 

I would like to create buckets for the values like this:

0 – 3000

3001 -5000

5001 -10000

10001 – 30000

30001 – 50000

50001 – max

Can any one help me on this how to bucket / group the values in the regex or suggest me how to achieve above scenario.

Thanks all

@All  

3 Replies

Avatar

Community Advisor

Regex for numbers is hard... since Regex is based on text values.. it doesn't recognize numerical values, it doesn't understand the concept of greater than / less than.. this means you will have to come up with complex regex rules that break the numbers down into expect values based on position and length.

 

Here is an article that explains how to create regex for numeric ranges:

https://www.regextutorial.org/regex-for-numbers-and-ranges.php

 

I also suggest you should use a tool like https://www.regextester.com/ to populate a bunch of values so that you can check that the rules you create match your expected output.

 

Good luck.

Avatar

Community Advisor

Here's something that's not immediately obvious about Classification Rule Builder: you can have more than one rule that classify a single eVar. AA will process the rules from #1 to #last.

So you could do the following:

Rule Number       Regex                                                               Classified Value

1                           *                                                                        Max

2                           ^(3000[1-9]|3[1-9][0-9]{3}|4[0-9]{4}|50000)$     30001 - 50000

3                           ^(1000[1-9]|1[1-9][0-9]{3}|2[0-9]{4}|30000)$     10001 - 30000

etc

Note: I have not tested any of the above regexes!

When you've set it up correctly, then when you test this rule set, you should (hopefully) get back your expected buckets.

Avatar

Level 2

Thanks all for the reply.

I have found Regex Numeric Range Generator URL https://3widgets.com/ . I think it will be helpful for all us.