Regular Expression to extract all numbers from a string to a group collection

Discussion in 'ASP .Net' started by Jay Douglas, Aug 27, 2004.

  1. Jay Douglas

    Jay Douglas Guest

    Hello all.
    I'm having a hard time coming up with a regular expression that can
    extract just the numbers out of string into a GroupCollection.

    Any help is appreciated.
     
    Jay Douglas, Aug 27, 2004
    #1
    1. Advertising

  2. Jay Douglas

    Curt_C [MVP] Guest

    reverse it, replace all non numerics to blank/empty and ta-da, numbers only

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    Site: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "Jay Douglas" <> wrote in message
    news:...
    > Hello all.
    > I'm having a hard time coming up with a regular expression that can
    > extract just the numbers out of string into a GroupCollection.
    >
    > Any help is appreciated.
    >
    >
    >
     
    Curt_C [MVP], Aug 27, 2004
    #2
    1. Advertising

  3. Jay Douglas

    Niki Estner Guest

    "Jay Douglas" <> wrote in
    news:...
    > Hello all.
    > I'm having a hard time coming up with a regular expression that can
    > extract just the numbers out of string into a GroupCollection.


    How about: RegEx.Matches(@"\b\d+\b")?
     
    Niki Estner, Aug 27, 2004
    #3
  4. Jay Douglas

    Jay Douglas Guest

    Perfect. Thank you.




    "Niki Estner" <> wrote in message
    news:...
    > "Jay Douglas" <> wrote in
    > news:...
    > > Hello all.
    > > I'm having a hard time coming up with a regular expression that can
    > > extract just the numbers out of string into a GroupCollection.

    >
    > How about: RegEx.Matches(@"\b\d+\b")?
    >
    >
     
    Jay Douglas, Aug 27, 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. VSK
    Replies:
    2
    Views:
    2,311
  2. Replies:
    1
    Views:
    5,758
    lordy
    Aug 7, 2006
  3. Øyvind Isaksen
    Replies:
    1
    Views:
    988
    Øyvind Isaksen
    May 18, 2007
  4. scsoce
    Replies:
    1
    Views:
    279
    Hrvoje Niksic
    Nov 21, 2008
  5. MRAB
    Replies:
    0
    Views:
    396
Loading...

Share This Page