Using Brackets and Ranges

  • Everything i've seen online says the brackets are used for ranges. None of them talk about double digit ranges. It would be nice to check for numbers 10 to 30. I guees I'll have to do something like this: '[123][0-9]'.

    Is that the only way?

    the real problem that I'm having is that I'm trying to find date values in a string. Some dates are 02-22-2010 and some are 2-22-10.

    The dates are not specific they can be literally any date.

  • Range searches on dates are easy, if they are coded as dates. If they are coded as strings, that makes it more difficult, especially if the format of the dates is random.

    So, is that case for you, character based dates with multiple formats?

  • Yes, intermixed with words. Example: "Ted was born 12-02-98 at hospital."

    How much worse can you get? lol.

  • I'm going to find the first occurenc of a number and then count based on the occurence of dashes. If there is one dash such as 03-10, then i will count 5 from first number. If there are two dashes then i will count 8 characters. That is the only way i can see to do this.

  • Jacob Pressures (4/30/2010)


    I'm going to find the first occurenc of a number and then count based on the occurence of dashes. If there is one dash such as 03-10, then i will count 5 from first number. If there are two dashes then i will count 8 characters. That is the only way i can see to do this.

    If the dates always appear in the mm-dd-yy format, then the pattern you should be looking for should be %[0-1][0-9]-[0-3][0-9]-[0-9][0-9]% and then substring out those 8 characters.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • thanks!

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply