You can use the following to remove the space in front
$Value =~ /s/^\s+//;
 
And for the sake of interest $Value =~ s/\s+$//; will remove any trailing
spaces from a string
 
Regards
Robert Graham

-----Original Message-----
From: Woz [mailto:[EMAIL PROTECTED]]
Sent: 25 October 2001 12:04
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Regular expression help!!


Wow, that was fast!
 
Thanks very much, that works well.
For my next question (:-)) how can I make it strip the leading space that it
leaves on the resulting string. i.e. I want it to strip 'insert_job: ' from
the string - note the trailing space.
 
At the moment I have: -
 
  ($Value)=$_=~m/(\W\w\S.*)/; 
  ($Value)=$Value=~m/(\S.*)/;
 
but I'm sure there's a far more elegant solution that combines it all into
one.
 
Many many thanks for your help.
 
Warren
<note to self - buy O'Reillys book on regular expressions!>


-----Original Message----- 
From: Robert Graham 
Sent: Thu 25/10/2001 10:27 
To: Woz; [EMAIL PROTECTED] 
Cc: 
Subject: RE: Regular expression help!!



Hi 

You can try the following: 

$line = "insert_job: DUKS_rtcf_daily_log_purge job_type: c"; 
($rest) = $line =~ m/(\W\w.*)/; 


Regards 
Robert 

-----Original Message----- 
From: Woz [ mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] 
Sent: 25 October 2001 11:17 
To: [EMAIL PROTECTED] 
Subject: Regular expression help!! 


Hi, 
  
I'm relatively new to the wonders of Perl programming and I've yet to 
quite get my head around regular expressions. 
I'm attempting to generate a search and replace expression that will 
turn the following string 
  
insert_job: DUKS_rtcf_daily_log_purge job_type: c 
  
into 
  
DUKS_rtcf_daily_log_purge job_type: c 
  
i.e. remove from the beginning of the line up the space following the 
first : 
All my efforts so far remove upto the second : though and leave just 
'c'. 
  
Any ideas? 
  
Any help much appreciated! 
  
Thanks, 
  
Warren 
  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to