1

I know a lot of syntax ( c#,c, vb and so on ) hence my head is pretty full.

So I tend to write regex like this
edit2 : change word RegRex
[0-9]{1,}[aA-zZ]{1,}

[0-9]{1,}[a-zA-Z]{1,}

No +, ?, \d, ...

Is there performance issues with this syntax?

edit : This question is wider than /d vs [0-9] syntax

1 Answers1

2

In terms of performance {1,} and + are equivalent, but the first has more characters to be read... And {1} is not necessary. That won't make much difference though.

More generally, it is not a matter of preference. If you have to match a numeric ID made of numbers from 1 to a big number, without + (or {1,}, or * using \d twice), that will be difficult

\d+

or

[0-9]+

or

[0-9][0-9]*

if you prefer.

Besides, [aA-zZ] matches a, Z (twice actually) and anything between A and z, including [, ], _ ... (see an ascii table)

Tushar
  • 78,625
  • 15
  • 134
  • 154
Breaking not so bad
  • 26,037
  • 5
  • 67
  • 96