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

Correct pattern Matching

Expand Messages
  • Jason Sperry
    I am having a problem with pattern matching. The script I am using parses a line of a log file and extracts the date, time and ip address. My problem is in
    Message 1 of 1 , Jul 31 9:24 PM
    • 0 Attachment
      I am having a problem with pattern matching.  The script I am using parses a line of a log file and extracts the date, time and ip address.  My problem is in the regular expression I am using.  For example, I use  @startDate = ($line1 =~ /(\d{2}\/\d{2}\/\d{2})/g) to match the date.  Notice I am using an array rather than a scalar variable because it only grabs one piece at a time.  If I use a scalar variable I'll simply get one digit.  Storing the in an array does not suit my needs as I have to do mathmatical calculations using the dates and times.  My question is how can I change the regular expression so that it returns the full date (in 01/22/00 format) at one time, so I can store it in a scalar vaiable.  Thanks in advance,
       
      --Jason Sperry
      http://bjorkradio.yi.org 
      The Internet's only all Bjork Radio Station
    Your message has been successfully submitted and would be delivered to recipients shortly.