VBdotnet2005
asked on
Regex - valid $
I need a pattern to valid txtbox like below and blank is not allowed. I am trying to apply to Regularexpressionvalidator .
0.00
1.00
25.00
100.00
etc
^(?:100,000|(?:(?:(?:\d?\d ,)?\d)?\d) ?\d)\.\d\d $
0.00
1.00
25.00
100.00
etc
^(?:100,000|(?:(?:(?:\d?\d
ASKER
If a textbox is blank, it does not catch it.
ASKER
This will not catch if TextBox1 is blank.
<asp:Content ID="Content1" ContentPlaceHolderID="Cont entPlaceHo lder1" Runat="Server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextB ox>
<asp:RegularExpressionVali dator ID="RegularExpressionValid ator1" runat="server" ErrorMessage="RegularExpre ssionValid ator" ControlToValidate="TextBox 1" ValidationExpression="^(?: 100,000|(? :(?:(?:\d? \d,)?\d)?\ d)?\d)\.\d \d$"></asp :RegularEx pressionVa lidator>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="Cont
<asp:TextBox ID="TextBox1" runat="server"></asp:TextB
<asp:RegularExpressionVali
</asp:Content>
ASKER
I can use Requiredfieldvalidator and RequiredfieldRegularExpres sion at the same time. It is kind of redundant, but that will work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The thing about using them side by side is the error message displaying.
If textbox1 is empty
textbox1 *required field
if textbox1 has an invalid number format
textbox1 *Invalid format
Is there a better way?
If textbox1 is empty
textbox1 *required field
if textbox1 has an invalid number format
textbox1 *Invalid format
Is there a better way?
Is there anything it's failing to match with where it should match, or vice versa?