Question

how can i produce the following pattern with databene benerator? A01,A02,A03...A25, then the same for B, C, D etc. So that I can even get other ranges like A01 to A15 etc. I have tried this

pattern="[0]{1}[7]{1}[0-9^[6,4]]{8}"

but it goes on to include A00, and A26 to A29.

specifically, how can i give the range of numbers e.g from 1 to 10, 1 to 20, etc.?

Was it helpful?

Solution

To get the range 01-25 with A..D prefix you can use this: [A-D](0[1-9]|1\d|2[0-5])
Explained demo here: http://regex101.com/r/gU3zA4

This: [A-G](0[1-9]|1\d|20) will get A-G from 01 to 20

This: [A-Z](0[1-9]|[1-6]\d|7[0-5]) will get A-Z from 01 to 75

This: [A-Z](0[1-9]|[1-9]\d) will get A-Z from 01 to 99

Pretty easy...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top