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

    Join Date
    Jun 2012
    Posts
    3
    Rep Power
    0

    Request Parsing Help


    Hi,

    This is what I would like to parse

    Code:
    Slot   Description                    State           Command         Status
    ============================================================================
    C00    XLR Control Module(M)          diag on-line
    O00    Optical Tributary Module       diag on-line
    O01    Optical Tributary Module       diag on-line
    O02    Optical Tributary Module       diag on-line
    O03    Optical Tributary Module       diag on-line
    O04    Optical Tributary Module       diag on-line
    O05       -                           slot empty
    O06       -                           slot empty
    O07       -                           slot empty
    O08       -                           slot empty
    O09       -                           slot empty
    X00    Optical Switching Module       diag on-line
    X01    Optical Switching Module       diag on-line
    X02    Optical Switching Module       diag on-line
    X03    Optical Switching Module       diag on-line
    X04    Optical Switching Module       diag on-line
    X05    Optical Switching Module       diag on-line
    X06    Optical Switching Module       diag on-line
    X07    Optical Switching Module       diag on-line
    X08    Optical Switching Module       diag on-line
    X09       -                           slot empty
    C01    XLR Control Module(S)          diag on-line
    T00    Timing Sync Module             diag on-line
    T01    Timing Sync Module             diag on-line
    Here is what I think ought to work (but does not)
    Code:
    (?<Name>[COXT]\d\d)\s+([\(\)\w]*\s)*-?\s{3,}(?<value>[\w\s-]*)
    This partial expression works
    Code:
    (?<Name>[COXT]\d\d)\s+([\(\)\w]*\s)*-?\s{3,}
    Even this works
    Code:
    (?<Name>[COXT]\d\d)\s+([\(\)\w]*\s)*-?\s{3,}(?<value>[\w-]*)
    Your help will be appreciated.
    (Note: there may be other "States".)

    ThatSamIam
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Location
    spaceBAR Central
    Posts
    229
    Rep Power
    42
    Ok, I see your input but what do you want your output to look like?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    3
    Rep Power
    0
    Originally Posted by spacebar208
    Ok, I see your input but what do you want your output to look like?
    Spacebar208,

    Thanks for looking at this. At ~650 views and no responses, I was getting worried.

    I would like:
    Name, Value
    (C00, diag on-line)
    (O00, diag on-line)
    (O01, diag on-line)
    (O02, diag on-line)
    (O03, diag on-line)
    (O04, diag on-line)
    (O05, slot empty)
    (O06, slot empty)
    (O07, slot empty)
    (O08, slot empty)
    (O09, slot empty)
    (X00, diag on-line)
    (X01, diag on-line)
    (X02, diag on-line)
    (X03, diag on-line)
    (X04, diag on-line)
    (X05, diag on-line)
    (X06, diag on-line)
    (X07, diag on-line)
    (X08, diag on-line)
    (X09, slot empty)
    (C01, diag on-line)
    (T00, diag on-line)
    (T01, diag on-line)


    Thanks again,
    ThatSamIam
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    3
    Rep Power
    0
    Ok, I figured it out:

    PHP Code:
    (?<Name>[COXT]\d\d)\s+([\(\)\w]*\s)*-?\s{5,}(?<Value>(\w+[\s-]{0,1})*$) 
    Thanks to those who gave it a shot.

IMN logo majestic logo threadwatch logo seochat tools logo