Regular expression for a list of numbers without other characters

Posted by JamesW on Stack Overflow See other posts from Stack Overflow or by JamesW
Published on 2010-03-19T13:40:20Z Indexed on 2010/03/19 13:41 UTC
Read the original article Hit count: 149

Filed under:
|

I need a regular expression for a list of numbers in a text box with carriage returns and line feeds, but no other characters.

e.g.

1234 
5678 
5874 
3478

I have this:

Regex(@"\d\r\n${0,}?");

... but it is accepting commas when I paste them into my text box:

e.g.

1234,
5678
5874,
3478

Can someone please tell me what I'm doing wrong?

Thanks

© Stack Overflow or respective owner

Related posts about regex

Related posts about c#