Darth Continent
Darth Continent

Reputation: 2319

RegularExpressionValidator syntax for multiline TextBox?

I have a multiline TextBox for which any of the following inputs are valid:

  1. Empty string (the text can optionally be blank upon submit).
  2. A single numeric (0 - 9) string, up to 9 digits long.
  3. Multiple numeric strings, each up to 9 digits long, each separated by carriage return (\r) and/or newline (\n).

What regular expression will enable me to validate these criteria, using a RegularExpressionValidator control? I'm currently experimenting with the excellent Expresso tool, but would appreciate insight in evaluating these multiple criteria efficiently at once.

Upvotes: 1

Views: 1217

Answers (1)

LukeH
LukeH

Reputation: 269358

^(?:\d{1,9}(?:[\r\n]\d{1,9})*)?$

Upvotes: 1

Related Questions