I've seen regex patterns that use explicitly numbered repetition instead of ?
, *
and +
, i.e.:
Explicit Shorthand
(something){0,1} (something)?
(something){1} (something)
(something){0,} (something)*
(something){1,} (something)+
The questions are:
- Are these two forms identical? What if you add possessive/reluctant modifiers?
- If they are identical, which one is more idiomatic? More readable? Simply "better"?