Loading ...
Sorry, an error occurred while loading the content.

Stripping chracters in an array

Expand Messages
  • Steve M
    Hi all again, I ll get straight to the point...again. #I have output in an array that looks similar to this: [01/03 11:13:22] Texttextext:text::handlertext:
    Message 1 of 2 , Jan 4, 2001
    • 0 Attachment
      Hi all again, I'll get straight to the point...again.

      #I have output in an array that looks similar to this:

      [01/03 11:13:22] Texttextext:text::handlertext: text Text TEXT Somethingtomatch text# text#
      [01/03 07:13:22] Texttextext:text::handlertext: text Text TEXT Somethingtomatch text# text#
      [01/03 13:13:22] Texttextext:text::handlertext: text Text TEXT Somethingtomatch text# text#
      [01/04 14:13:22] Texttextext:text::handlertext: text Text TEXT Somethingtomatch text# text#
      [01/04 15:13:22] Texttextext:text::handlertext: text Text TEXT Somethingtomatch text# text#

      So on for multiple lines, I put this stuff into an array. BTW, this is what the output was from my previous post regarding opening multiple files at once. Anyway. What I need to accomplish is to strip the two brackets ([....]) where the date and time is at the beginning. I can accomplish that with a regexp in a foreach loop. But if I wanted to match the date with the current date (via localtime module defined earlier in my script) I could do so only with the current date. I'd like to put the previous day's stuff into another array.
      I'd like to match the 'Texttextext:text::handlertext:' to a string also previously defines and 'Somethingtomatch' to a previously defined string.

      Ultimatly I only need two array's because I'm only trying to seperate the lines that have a different date. As far as matching the other stuff I can put that into the same array but they just have to be neatly arranged. I've tried putting the output into another array and I know I can accomplish this with still more regexp but would like to know if there is an easier way to accomplish this without putting more code than necessary.

      Thanks,
      Steve M
    • Steve Milo
      ... Somethingtomatch text# text# ... Somethingtomatch text# text# ... Somethingtomatch text# text# ... Somethingtomatch text# text# ... Somethingtomatch text#
      Message 2 of 2 , Jan 4, 2001
      • 0 Attachment
        >
        > [01/03 11:13:22] Texttextext:text::handlertext: text Text TEXT
        Somethingtomatch text# text#
        > [01/03 07:13:22] Texttextext:text::handlertext: text Text TEXT
        Somethingtomatch text# text#
        > [01/03 13:13:22] Texttextext:text::handlertext: text Text TEXT
        Somethingtomatch text# text#
        > [01/04 14:13:22] Texttextext:text::handlertext: text Text TEXT
        Somethingtomatch text# text#
        > [01/04 15:13:22] Texttextext:text::handlertext: text Text TEXT
        Somethingtomatch text# text#
        >

        The line ends at the last 'text#' and begins at the '[01/..' my email
        managed to screw this up.

        Steve M
      Your message has been successfully submitted and would be delivered to recipients shortly.