Regex problems

Discussion in 'ASP .Net' started by George Ter-Saakov, Aug 16, 2007.

  1. I need a regular expression that would validate string like this.

    aa5677

    Any 2 literal characters and then any amount of digits from 1 to ...
    aa345k is not valid.

    Can someone write this for me.

    Thanks
    George.
     
    George Ter-Saakov, Aug 16, 2007
    #1
    1. Advertising

  2. On Aug 16, 8:35 pm, "George Ter-Saakov" <> wrote:
    > I need a regular expression that would validate string like this.
    >
    > aa5677
    >
    > Any 2 literal characters and then any amount of digits from 1 to ...
    > aa345k is not valid.
    >
    > Can someone write this for me.
    >
    > Thanks
    > George.


    ^[a-zA-Z]{2}\d*$
     
    Alexey Smirnov, Aug 16, 2007
    #2
    1. Advertising

  3. On Aug 16, 8:35 pm, "George Ter-Saakov" <> wrote:
    > any amount of digits from 1 to ...


    Ah, change ( * ) to ( + ), like this

    ^[a-zA-Z]{2}\d+$

    it will require at least one digit
     
    Alexey Smirnov, Aug 16, 2007
    #3
  4. Thanks, saved me one headache today :)

    George.

    "Alexey Smirnov" <> wrote in message
    news:...
    > On Aug 16, 8:35 pm, "George Ter-Saakov" <> wrote:
    >> I need a regular expression that would validate string like this.
    >>
    >> aa5677
    >>
    >> Any 2 literal characters and then any amount of digits from 1 to ...
    >> aa345k is not valid.
    >>
    >> Can someone write this for me.
    >>
    >> Thanks
    >> George.

    >
    > ^[a-zA-Z]{2}\d*$
    >
     
    George Ter-Saakov, Aug 16, 2007
    #4
  5. Yea, thanks
    I figured that one myself
    After an hour of reading MSDN I gave up and wrote to you guys. But now I
    know something about Regex



    George.

    "Alexey Smirnov" <> wrote in message
    news:...
    > On Aug 16, 8:35 pm, "George Ter-Saakov" <> wrote:
    >> any amount of digits from 1 to ...

    >
    > Ah, change ( * ) to ( + ), like this
    >
    > ^[a-zA-Z]{2}\d+$
    >
    > it will require at least one digit
    >
     
    George Ter-Saakov, Aug 16, 2007
    #5
    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?SmViQnVzaGVsbA==?=

    Is ASP Validator Regex Engine Same As VS2003 Find Regex Engine?

    =?Utf-8?B?SmViQnVzaGVsbA==?=, Oct 22, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    712
    =?Utf-8?B?SmViQnVzaGVsbA==?=
    Oct 22, 2005
  2. Rick Venter

    perl regex to java regex

    Rick Venter, Oct 29, 2003, in forum: Java
    Replies:
    5
    Views:
    1,634
    Ant...
    Nov 6, 2003
  3. Replies:
    2
    Views:
    600
  4. Xah Lee
    Replies:
    1
    Views:
    943
    Ilias Lazaridis
    Sep 22, 2006
  5. Replies:
    3
    Views:
    769
    Reedick, Andrew
    Jul 1, 2008
Loading...

Share This Page