Supermercado
Diamond Member
I'm working on a regular expression and it's been a while since I've used them and even then, it wasn't for anything terribly complex, so I'm a bit rusty.
I'm trying to match 0 or 2 digits and only 0 or 2 digits. Is the best way to do that as follows?
([0-9]{0}|[0-9]{2})
That works but it seems a bit ungainly.
This is more just a curiosity now since what I have works but if there was a better way to do it, I'd be interested in knowing. Thanks.
I'm trying to match 0 or 2 digits and only 0 or 2 digits. Is the best way to do that as follows?
([0-9]{0}|[0-9]{2})
That works but it seems a bit ungainly.
This is more just a curiosity now since what I have works but if there was a better way to do it, I'd be interested in knowing. Thanks.