Re: A regular expression question -- Emergency

2005-09-30 Thread Richard A. Wells
$Bill Luebkert wrote: Richard A. Wells wrote: [...] The _expression_ $path_elem =~ s{(\s)}{\\$1}gio; The /io is not needed/wanted. Right about the /i. That's conventional laziness on my part, as it is usually what I want, though it would be detrimental in this

Re: A regular expression question -- Emergency

2005-09-30 Thread $Bill Luebkert
Richard A. Wells wrote: > $Bill Luebkert wrote: >> Richard A. Wells wrote: >> >>> [...] >>> >>> The expression >>> >>> $path_elem =~ s{(\s)}{\\$1}gio; >>> >> >> The /io is not needed/wanted. >> > Right about the /i. That's conventional laziness on my part, as it is > usually what I w

Re: A regular expression question -- Emergency

2005-09-30 Thread $Bill Luebkert
Richard A. Wells wrote: > On UNIX you have to escape the whitespace, e.g. > > /this path/has spaces > > would become > > /this\ path/has\ spaces > > The expression > > $path_elem =~ s{(\s)}{\\$1}gio; The /io is not needed/wanted. > should do the trick. > > Note that I used {} d

Re: A regular expression question -- Emergency

2005-09-30 Thread Richard A. Wells
On UNIX you have to escape the whitespace, e.g. /this path/has spaces would become /this\ path/has\ spaces The expression $path_elem =~ s{(\s)}{\\$1}gio; should do the trick. Note that I used {} delimiters (i.e. s{}{}) to make it clearer, since the data itself contains /s and som

Re: A regular expression question -- Emergency

2005-09-30 Thread Richard A. Wells
On UNIX you have to escape the whitespace, e.g. /this path/has spaces would become /this\ path/has\ spaces The expression $path_elem =~ s{(\s)}{\\$1}gio; should do the trick. Note that I used {} delimiters (i.e. s{}{}) to make it clearer, since the data itself contains /s and someone might

A regular expression question -- Emergency

2005-09-30 Thread Cai, Lucy \(L.\)
Hi All, I am meeting a problem on a regular expression. My code is like: $path_elem = "$ENV{'CLEARCASE_PN'}"; The return value of $path_elem is either $path_elem = /ccstore/test/test.pl Or $path_elem = /ccstore/test 1/test 1.pl # there is a space in the path name including the file name too

Re: A regular expression question

2004-11-12 Thread Ted Schuerzinger
$Bill Luebkert graced perl with these words of wisdom: >>>B. I want to get 1.62 from the string, how can I do it? >> >> >> Nobody seems to have answered part B. > > Actually they did. Sam's for one : > > $string = "sct-1.62-1"; > print "$1\n" if ($string =~ /^.+-(.+)-.+$/); You mean $1 capt

Re: A regular expression question

2004-11-11 Thread $Bill Luebkert
Ted Schuerzinger wrote: > Cai, Lixin (L.) graced perl with these words of wisdom: > > >>My $string = "sct-1.62-1"; >> >>I have 2 regular expression question here, >> >>A. I want to check whether the format is "XXX-XXX-XXX", how can I do it? This format doesn't actually match the example given.

Re: A regular expression question

2004-11-11 Thread Ted Schuerzinger
Cai, Lixin (L.) graced perl with these words of wisdom: > My $string = "sct-1.62-1"; > > I have 2 regular expression question here, > > A. I want to check whether the format is "XXX-XXX-XXX", how can I do it? > B. I want to get 1.62 from the string, how can I do it? Nobody seems to have answere

RE: A regular expression question

2004-11-11 Thread Gardner, Sam
Title: Message or even. . .   $string = "sct-1.62-1";print "$1\n" if ($string =~ /^.+-(.+)-.+$/);   (no need to use the backslash escape for the dashes; they're not part of a character class. . .     Sam Gardner GTO Application Development

RE: A regular expression question

2004-11-11 Thread Peter Eisengrein
Title: A regular expression question Your format does not match XXX-XXX-XXX so I'll guess you mean three fields delimited by a dash.   here's one way to do it   $string = "sct-1.62-1"; print "$1\n" if ($string =~ /^.+\-(.+)\-.+$/)           -Origina

A regular expression question

2004-11-11 Thread Cai, Lixin \(L.\)
Title: A regular expression question  Now I have a string like My $string = "sct-1.62-1"; I have 2 regular _expression_ question here, A. I want to check whether the format is "XXX-XXX-XXX", how can I do it? B. I want to get 1.62 from the string, how can I do i

RE: A regular expression question

2002-09-18 Thread Carlos Guillen
while (<>) { if ( /^#/ ){ print; } } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 3:12 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: A regular expression question

RE: A regular expression question

2002-09-12 Thread Jing Wee
r 12, 2002 3:12 PM >To: [EMAIL PROTECTED]; >[EMAIL PROTECTED]; >[EMAIL PROTECTED] >Subject: A regular expression question > > >I have a cron file which the line looks like this: > >00 22 * * * perl -S queue_submit.pl esd-foundry "perl -S host-scrubber.pl" >#bui

RE: A regular expression question

2002-09-12 Thread Thomas_M
Cai_lixin wrote: > I want to get the comment after # of each line(not including > "#"), how could I do this? Depends. If you might have a # in a command, you'll want everything after the last #. If you're more likely to have another # in a comment, you want everything after the first #. (if you

Re: A regular expression question

2002-09-12 Thread Jing Wee
At 03:11 PM 9/12/2002 -0400, [EMAIL PROTECTED] wrote: >I have a cron file which the line looks like this: > >00 22 * * * perl -S queue_submit.pl esd-foundry "perl -S host-scrubber.pl" >#build host scrubber >30 22 * * * perl -S queue_submit.pl esd-foundry "perl -S group-scrubber.pl" >#build group s

RE: A regular expression question

2002-09-12 Thread Peter Guzis
ROTECTED]] Sent: Thursday, September 12, 2002 12:12 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: A regular expression question I have a cron file which the line looks like this: 00 22 * * * perl -S queue_submit.pl esd-foundry "perl -S host-scrubber.pl" #

RE: A regular expression question

2002-09-12 Thread Joseph P. Discenza
[EMAIL PROTECTED] wrote, on Thursday, September 12, 2002 3:12 PM : I have a cron file which the line looks like this: : : 00 22 * * * perl -S queue_submit.pl esd-foundry "perl -S host-scrubber.pl" : #build host scrubber : 30 22 * * * perl -S queue_submit.pl esd-foundry "perl -S : group-scrubber.

RE: A regular expression question

2002-09-12 Thread Peter Eisengrein
Title: RE: A regular expression question foreach my $line () {     my ($comment) = $line =~ /^\#(.*)$/; }         > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 12, 2002 15:12 > To: [EMAIL PROTECTE

A regular expression question

2002-09-12 Thread Cai_Lixin
I have a cron file which the line looks like this: 00 22 * * * perl -S queue_submit.pl esd-foundry "perl -S host-scrubber.pl" #build host scrubber 30 22 * * * perl -S queue_submit.pl esd-foundry "perl -S group-scrubber.pl" #build group scrubber 30 22 * * * perl -S queue_submit.pl esd-foundry "per