Home All Groups Group Topic Archive Search About

regular expression pattern ?

Author
6 May 2006 8:05 PM
Jon Paal
need pattern to determine if value is an integer (0-9 digits only) > 0

Regex.IsMatch(<Input>, "????")

Author
6 May 2006 9:02 PM
Herfried K. Wagner [MVP]
"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> schrieb:
> need pattern to determine if value is an integer (0-9 digits only) > 0
>
> Regex.IsMatch(<Input>, "????")

"^\d*$" or "^[0-9]*$".

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
8 May 2006 8:37 AM
david
On 2006-05-06, Herfried K. Wagner [MVP] <hirf-spam-me-here@gmx.at> wrote:
> "Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> schrieb:
>> need pattern to determine if value is an integer (0-9 digits only) > 0
>>
>> Regex.IsMatch(<Input>, "????")
>
> "^\d*$" or "^[0-9]*$".

Or possibly "^\d+$".  "^\d*$" will match an empty string, which probably
isn't a valid integer, depending on context.