#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    3
    Rep Power
    0

    I need help with a conditional requirement please.


    I am parsing a file line by line, and I need to have a match if the line has a time goup on its own or if it is the first one of 5 time groups, but no match if it is one of 4 time groups. If a match the returned result should be the first time.

    Examples
    " 00:25 29:15 55:55 128:15 79:10 " Match need the first time
    " 26:00 63:45 123:23 63:23 " require no match
    " 00:25" Match need the time

    I have tried
    ^\s{0,10}(\d\d:\d\d)\W{3,3}|^\s{0,10}(\d\d:\d\d).{30,}

    but this is the wrong approach I think.

    To aid understanding these times are from a pilot roster, the time I am trying to cpture is the landing time after midnight. A flight over midnight only happens in case 1 and 3, however the other times which are duty times and flying times are not required.

    I would appriciate a guru helping me.

    Thanks

    Tom
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,965
    Rep Power
    9397
    So a time, and if anything follows it then it's exactly four more times?
    Code:
    ^\s*(\d\d:\d\d)((\d\d:\d\d){4})?\s*$
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    3
    Rep Power
    0
    Originally Posted by requinix
    So a time, and if anything follows it then it's exactly four more times?
    Code:
    ^\s*(\d\d:\d\d)((\d\d:\d\d){4})?\s*$
    Thanks for the very quick reply
    This worked for cases 2 and 3
    but case 1
    00:25 29:15 55:55 128:15 79:10
    did not identify 00:25, the fourth time group is over 100 hours it will never be 1000hrs.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    9
    Rep Power
    0
    "([0-9 : ]{32})"|"([0-9: ]{6})" try this. this worked with the two time matches
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    3
    Rep Power
    0
    Originally Posted by satsou19
    "([0-9 : ]{32})"|"([0-9: ]{6})" try this. this worked with the two time matches
    Thanks very much
    I will try it tomorrow

    All the best

    Tom

IMN logo majestic logo threadwatch logo seochat tools logo