• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Quick Regular Expression Question

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.
 
Back
Top