in reply to regex - parsing a string with many optional fields

Well, it doesn't look like you are making any decisions based on what type of duration is being read, so why not simplify it, e.g:

my @temp = $str =! /([PT]\d+[YMWDHMS])/g;

Replies are listed 'Best First'.
Re: Re: regex - parsing a string with many optional fields
by dragonchild (Archbishop) on Feb 25, 2004 at 14:30 UTC
    Note that this will not actually finish the parsing. Once the string has been broken out into its component parts (which this will do), more work needs to be done in order to properly understand the string.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.