$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
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
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
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
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
$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
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.
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
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
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 =~ /^.+\-(.+)\-.+$/)
-Original Message-From: Cai, Lixin (L
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
I have
>while (<>) {
>if ( /^#/ ){
> print;
> }
>}
This will include the "#" which the original poster does not want.
>-Original Message-
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, September 12, 2002 3:12 PM
>To: [EMAIL PROTECTED];
>[E
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
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
open (FH, ") {
if (/^#(.+)/) {
chomp (my $comment = $1);
print "$comment\n";
}
}
close (FH);
Peter Guzis
Web Administrator, Sr.
ENCAD, Inc.
- A Kodak Company
email: [EMAIL PROTECTED]
www.encad.com
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: T
[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.
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
17 matches
Mail list logo