Regular expression help

Discussion in 'Java' started by Manish Hatwalne, Dec 16, 2003.

  1. I am trying few things with regular expression, I would like to allow
    following characters, how do I do this?

    wher N is a digit.

    - Manish
    Manish Hatwalne, Dec 16, 2003
    1. Advertisements

  2. Manish Hatwalne

    Virgil Green Guest

    The first thing I'd do if learning regex is download the free (for
    non-commercial use) Regex Coach at

    I'm unsure of your question, though. Do you want to allow any of those
    patterns in a string?

    - Virgil
    Virgil Green, Dec 16, 2003
    1. Advertisements

  3. Thanks a ton for regex-coach link!!!

    I sort of figured it out (with some help from friends), and got thisone
    which works for single comma, I am just looking for a small modification
    that will work for multiple commas.

    This is what I have, which works for single comma

    My valid strings would be -


    I'd prefer if I could get the pattern that I have got a bit modified so as
    to work for my multiple comms requiement.

    - Manish
    Manish Hatwalne, Dec 16, 2003
  4. Manish Hatwalne

    Chris Smith Guest

    Looks to me like:


    That's assuming you also want to allow "N+N" and "N,". If not, please
    be more clear about what you want. (Or is it *just* the list above? in
    which case "[0-9]((\,[0-9])|\+|(\-[0-9]?))?" looks like it might work.)

    The Easiest Way to Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
    Chris Smith, Dec 16, 2003
  5. Manish Hatwalne

    Alan Moore Guest

    Alan Moore, Dec 17, 2003
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.