Tuesday, January 15, 2008

Regular Expression Pattern for 1 or 2 digit number

following pattern would match 1 or two digit number:

[0-9]?

"[0-9]" will match any number from 1 to 9.
"?" will match if the previous number repeated 0 or 1 time.

No comments: