PAGE2GO2 HOME | INTERNET NEWS

LeighExchange - Free Advertising Network Stock Research at Internet Speed

Need help with a Regex substitution

 List
Subject: Need help with a Regex substitution
Poster: Paul
Date: 23 Mar 2007 14:11:37 -0700
Related Postings: 1 2 3 4
Hi there, I am updating a Perl script and am having difficulties understanding a string substitution in one of the subroutines (I didn't write it - I'm just trying to update it). I'm still a novice when it comes to Regular Expressions so I could use some help understanding one particular regex.

Here are the 3 lines of interest: --- 1: time_line = "$1\/$2\/$3\"\t\"$4:$5 $6"; 2: time_line =~ s/^0//; 3: time_line =~ s/(^\d+\/)0/\1/; ---

at line 1, the variable equals something like : "03/23/07\" \"3:05 pm" at line 2, I expect that the first '0' is removed, so the variable now equals : "3/23/07\" \"3:05 pm"

==> What does line 3 do??

I've tried guessing, but just can't figure it out. Something about repeating pattern of digits.. or not .. followed by a '0'? Then.. dunno. I got nothin.

Help! Please!

TIA. Paul.

 

Page2Go2.com is not responsible for content of this message.