Reputation: 985
I am trying to create a regular expression that handles 0-9 * or basically \d* but also include the or (|) with an expression to handle a specific word. So the idea im shooting for should be this
\d*|[Word]
The reason i need this to happen is i have a filter textbox with my validator applied to it to prevent bogus data being entered, but the trick is i have the default text of the textbox set to what is to be entered into the box, such as "Enter Account." I need the regular expression to handle \d* for the account number validation and the | part of the expression to allow the default text of the textbox to pass validation. I do checking on the back end so this default text wont break the app. I have 3 filter boxes where i'll be using this expression..if possible.
Upvotes: 0
Views: 139
Reputation: 30273
You basically have it, but lose the []
, which indicate character classes:
^\d*|word$
Also, you should anchor your validation expressions with ^
and $
.
Upvotes: 1