Regular Expression question

  • Thread starter Thread starter Josh
  • Start date Start date
J

Josh

How can i do this in regular expressions:

I want a two digit value that is between 01 and 99.

Since 00 does not match I can't just do two digits. I need some kind of rule
that says if first digit is 0 then second digit cannot be 0.

TIA

Josh
 
Josh said:
How can i do this in regular expressions:

I want a two digit value that is between 01 and 99.

Since 00 does not match I can't just do two digits. I need some kind of
rule
that says if first digit is 0 then second digit cannot be 0.

I think that's easiest with an alternation:

(0[1-9])|([1-9][0-9])

Niki
 
Thanks! That works.

Niki Estner said:
Josh said:
How can i do this in regular expressions:

I want a two digit value that is between 01 and 99.

Since 00 does not match I can't just do two digits. I need some kind of
rule
that says if first digit is 0 then second digit cannot be 0.

I think that's easiest with an alternation:

(0[1-9])|([1-9][0-9])

Niki
 
Back
Top