ValidationExpression

Discussion in 'ASP .Net Web Controls' started by metridevkk, Dec 3, 2004.

  1. metridevkk

    metridevkk Guest

    Hi,
    I have attached a RegularExpressionValidator Control to a textbox to accept
    numeric values in the format:

    ###*#####*##

    I have entered the following regex in the ValidationExpression:

    [0-9]{3}\*[0-9]{5}\*[0-9]{2}
    or
    [0-9]{3}[\*][0-9]{5}[\*][0-9]{2}

    but validator fails to validate an input such as:

    111*11111*11

    Could someone please guide me on what is wrong in the regular expression
    that i have specified?

    Thanks.
     
    metridevkk, Dec 3, 2004
    #1
    1. Advertising

  2. metridevkk

    Scott M. Guest

    \d{3}*\d{5}*\d{2}


    "metridevkk" <> wrote in message
    news:...
    > Hi,
    > I have attached a RegularExpressionValidator Control to a textbox to
    > accept
    > numeric values in the format:
    >
    > ###*#####*##
    >
    > I have entered the following regex in the ValidationExpression:
    >
    > [0-9]{3}\*[0-9]{5}\*[0-9]{2}
    > or
    > [0-9]{3}[\*][0-9]{5}[\*][0-9]{2}
    >
    > but validator fails to validate an input such as:
    >
    > 111*11111*11
    >
    > Could someone please guide me on what is wrong in the regular expression
    > that i have specified?
    >
    > Thanks.
    >
     
    Scott M., Dec 3, 2004
    #2
    1. Advertising

  3. metridevkk

    metridevkk Guest

    Interestingly, my expression:

    [0-9]{3}\*[0-9]{5}\*[0-9]{2}

    worked on another machine. But on my machine it does not validate the input
    in the browser. Vey wierd.

    I tried your expression on my machine, but the validator(at design time)
    wouldn't accept & said "Invalid property value: \d{3}*\d{5}*\d{2} is not a
    valid regular expression". Mayme it will work on the other machine. If so,
    then something wrong on my machine only:).

    Thanks



    "Scott M." wrote:

    > \d{3}*\d{5}*\d{2}
    >
    >
    > "metridevkk" <> wrote in message
    > news:...
    > > Hi,
    > > I have attached a RegularExpressionValidator Control to a textbox to
    > > accept
    > > numeric values in the format:
    > >
    > > ###*#####*##
    > >
    > > I have entered the following regex in the ValidationExpression:
    > >
    > > [0-9]{3}\*[0-9]{5}\*[0-9]{2}
    > > or
    > > [0-9]{3}[\*][0-9]{5}[\*][0-9]{2}
    > >
    > > but validator fails to validate an input such as:
    > >
    > > 111*11111*11
    > >
    > > Could someone please guide me on what is wrong in the regular expression
    > > that i have specified?
    > >
    > > Thanks.
    > >

    >
    >
    >
     
    metridevkk, Dec 3, 2004
    #3
  4. metridevkk

    Scott M. Guest

    Sorry about that. The asterisk char needs to be escaped because it is a
    reserved char. This works:

    \d{3}\*\d{5}\*\d{2}


    "metridevkk" <> wrote in message
    news:...
    > Interestingly, my expression:
    >
    > [0-9]{3}\*[0-9]{5}\*[0-9]{2}
    >
    > worked on another machine. But on my machine it does not validate the
    > input
    > in the browser. Vey wierd.
    >
    > I tried your expression on my machine, but the validator(at design time)
    > wouldn't accept & said "Invalid property value: \d{3}*\d{5}*\d{2} is not a
    > valid regular expression". Mayme it will work on the other machine. If so,
    > then something wrong on my machine only:).
    >
    > Thanks
    >
    >
    >
    > "Scott M." wrote:
    >
    >> \d{3}*\d{5}*\d{2}
    >>
    >>
    >> "metridevkk" <> wrote in message
    >> news:...
    >> > Hi,
    >> > I have attached a RegularExpressionValidator Control to a textbox to
    >> > accept
    >> > numeric values in the format:
    >> >
    >> > ###*#####*##
    >> >
    >> > I have entered the following regex in the ValidationExpression:
    >> >
    >> > [0-9]{3}\*[0-9]{5}\*[0-9]{2}
    >> > or
    >> > [0-9]{3}[\*][0-9]{5}[\*][0-9]{2}
    >> >
    >> > but validator fails to validate an input such as:
    >> >
    >> > 111*11111*11
    >> >
    >> > Could someone please guide me on what is wrong in the regular
    >> > expression
    >> > that i have specified?
    >> >
    >> > Thanks.
    >> >

    >>
    >>
    >>
     
    Scott M., Dec 4, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?T2xpdmVyIFNjaHVsemU=?=

    ValidationExpression Syntax

    =?Utf-8?B?T2xpdmVyIFNjaHVsemU=?=, May 12, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,220
    =?Utf-8?B?T2xpdmVyIFNjaHVsemU=?=
    May 12, 2004
  2. =?Utf-8?B?SklNLkgu?=

    ValidationExpression

    =?Utf-8?B?SklNLkgu?=, Nov 17, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    8,250
    Peter Blum
    Nov 18, 2004
  3. TD
    Replies:
    3
    Views:
    8,765
  4. Replies:
    3
    Views:
    726
    Rad [Visual C# MVP]
    Nov 17, 2006
  5. Nathan Sokalski
    Replies:
    2
    Views:
    929
    Nathan Sokalski
    Jan 3, 2007
Loading...

Share This Page