i think i got it working correctly. thanks for your help:
my ($ip, $ident, $userid, $time, $cgi, $url, $proto, $status,
$size_tx, $ref, $ua, $size_rx, $re_time) = /^
([-0-9\.]+)\# ip address
(\S+)\ # i
Oops, I found an error my parser. Here's version 1.0.2:
DATA_LOOP:
while( my $line = ){
print $line;
my @captured = ( '' );
my $inside = 0;
CAPTURE_LOOP:
while( 1 ){
if( $line =~ m{ \G ( [^"\\]+ | \\ ["\\] ) }gcx ){
$captured[-1] .= $1 if $inside;
}elsif( $line =~ m{ \G \
On Wed, 21 Nov 2012 20:54:29 -0500
shawn wilson wrote:
> how do i capture all quoted strings?
OK, I rewrote it as a simple parser:
DATA_LOOP:
while( my $line = ){
print $line;
my @captured = ( '' );
my $inside = 0;
CAPTURE_LOOP:
while( 1 ){
if( $line =~ m{ \G ( [^"\\]+ | \\ ["\\
On Wed, 21 Nov 2012 20:54:29 -0500
shawn wilson wrote:
> to match - and sometimes there are spaces before the match, a '\' with
> no '"', etc.
I think you want something like:
while( ){
my @captured = m{ \" ( [^"\\]* (?: \\ ["\\] [^"\\]* )* ) \" }gx;
print;
print "\t$_\n" for @captured
oh, and just to be clear (since i suppose it wasn't by me saying that
i was looking at the regexes in other modules to accomplish this) this
is, as someone else (on this list) once told me "masturbation with
code". i can do what i set off to accomplish but i just wanted more
and it annoyed me that
that's a pretty cool module - i especially like their regex with
lookup table trick. however, since i've got a decently lengthy regex
written to do what i want, and because i'm itching to know how to
actually do this at this point (i'd really like to know what's wrong
with the regex i posted as wel
On Wed, 21 Nov 2012 20:54:29 -0500
shawn wilson wrote:
> how do i capture all quoted strings?
Get Regexp::Common from CPAN and read Regexp::Common::delimited.
http://search.cpan.org/~abigail/Regexp-Common-2011121001/
--
Just my 0.0002 million dollars worth,
Shawn
Programming is
how do i capture all quoted strings?
this gives an error:
print "$str1\n";
($one, $two) = $str1 =~/"([^(?:[^"]")]*)" (\d+)/;
print "$one $two\n";
what i want is:
$str1 = "\"something\" 444";
$str1 = "\"\\\"escaped quote\\\" 321";
$str1 = "\"\\\"esc quote\\\" other stuff\" 567";
to match - and s
Am 2012-09-27 13:16, schrieb Shlomi Fish:
Hi Matthias,
On Thu, 27 Sep 2012 12:50:56 +0200
Matthias Leopold wrote:
hi,
i'm using the example from man perlop for here docs with indentation
i'm using vim syntax with "set list" and "set number lines"
1 ^I(my $quote =<<'^IFINIS') =~ s/^\s+//
Hi Matthias,
On Thu, 27 Sep 2012 12:50:56 +0200
Matthias Leopold wrote:
> hi,
>
> i'm using the example from man perlop for here docs with indentation
> i'm using vim syntax with "set list" and "set number lines"
>
>1 ^I(my $quote = <<'^IFINIS') =~ s/^\s+//gm;$
>2 ^IThe Road goes ever
hi,
i'm using the example from man perlop for here docs with indentation
i'm using vim syntax with "set list" and "set number lines"
1 ^I(my $quote = <<'^IFINIS') =~ s/^\s+//gm;$
2 ^IThe Road goes ever on and on,$
3 $
4 ^I$
5 ^Idown from the door where it began.$
6 ^IFINIS$
why does
Shlomi Fish wrote:
On Friday 02 Jul 2010 17:29:27 Dr.Ruud wrote:
sdDirtySox wrote:
I want to use a perl script that will look at all the files in a
directory to find an instance of a function and replace it with
another. I have the code in place to look at all the files in a
directory and to
On Friday 02 Jul 2010 17:29:27 Dr.Ruud wrote:
> sdDirtySox wrote:
> > I want to use a perl script that will look at all the files in a
> > directory to find an instance of a function and replace it with
> > another. I have the code in place to look at all the files in a
> > directory and to search
Thanks for responding. I'll give it a try.
On Jul 2, 5:10 am, jwkr...@shaw.ca ("John W. Krahn") wrote:
> sdDirtySox wrote:
> > Hi all,
>
> Hello,
>
> > I want to use a perl script that will look at all the files in a
> > directory to find an instance of a function and replace it with
> > another.
sdDirtySox wrote:
I want to use a perl script that will look at all the files in a
directory to find an instance of a function and replace it with
another. I have the code in place to look at all the files in a
directory and to search line by line, but I'm having problems with the
regex to use.
sdDirtySox wrote:
Hi all,
Hello,
I want to use a perl script that will look at all the files in a
directory to find an instance of a function and replace it with
another. I have the code in place to look at all the files in a
directory and to search line by line, but I'm having problems with
Hi all,
I want to use a perl script that will look at all the files in a
directory to find an instance of a function and replace it with
another. I have the code in place to look at all the files in a
directory and to search line by line, but I'm having problems with the
regex to use.
Example:
s
Bruce Ferrell wrote:
if ( ! defined $username || ! $username =~ /[0-9]{10,11}/ ) {
do something;
} else {
do something else;
}
if ( $username and $username =~ /\A[0-9]{10,11}\z/ ) {
...;
}
else {
die;
}
--
Ruud
--
To unsubscribe, e-mail: beginners-unsubscr...@p
Bruce Ferrell wrote:
> if ( ! defined $username || ! $username =~ /[0-9]{10,11}/ ) {
>
> do something;
>
> } else {
>
> do something else;
>
> }
>
> what that's supposed to do is this:
> if it's blank or not 10 or 11 digits...
>
> The question is where is my understanding faulty or did I me
On 24/03/10 00:13 -0700, Bruce Ferrell wrote:
if ( ! defined $username || ! $username =~ /[0-9]{10,11}/ ) {
do something;
} else {
do something else;
}
what that's supposed to do is this:
if it's blank or not 10 or 11 digits...
The question is where is my understanding faulty or did I mess
if ( ! defined $username || ! $username =~ /[0-9]{10,11}/ ) {
do something;
} else {
do something else;
}
what that's supposed to do is this:
if it's blank or not 10 or 11 digits...
The question is where is my understanding faulty or did I mess up.
Thanks in advance
Bruce
--
To unsubscri
Parag Kalra wrote:
You can try following:
$_ =~ s/^\.(\s)+//g;
You are using capturing parentheses but you are not using the results of
that capture anywhere so why use them? You are using capturing
parentheses in LIST context so even if there are multiple whitespace
characters you are onl
Thanks Philip for sharing this excellent piece of information.
Cheers,
Parag
On Tue, Dec 22, 2009 at 8:17 PM, Philip Potter wrote:
> 2009/12/22 Parag Kalra :
> > You can try following:
> >
> > $_ =~ s/^\.(\s)+//g;
>
> This isn't quite right.
>
> There are two ways in which you might use this
Philip Potter wrote:
> 2009/12/22 Parag Kalra :
>> You can try following:
>>
>> $_ =~ s/^\.(\s)+//g;
>
> This isn't quite right.
>
> There are two ways in which you might use this substitution: either $_
> will contain a single line, or it will contain multiple lines. The
> single line case might
2009/12/22 Parag Kalra :
> You can try following:
>
> $_ =~ s/^\.(\s)+//g;
This isn't quite right.
There are two ways in which you might use this substitution: either $_
will contain a single line, or it will contain multiple lines. The
single line case might look something like this:
while (<>)
You can try following:
$_ =~ s/^\.(\s)+//g;
Cheers,
Parag
On Tue, Dec 22, 2009 at 10:59 AM, Jim Green wrote:
> Hi,
>
> I have a text file with lines like this
>
>
> · Experience in C/C++ realtime system programming
>
> · Experience in ACE, FIX
>
>
> Could anybody tell me whic
Hi,
I have a text file with lines like this
· Experience in C/C++ realtime system programming
· Experience in ACE, FIX
Could anybody tell me which regex to use to get rid of the dot and the
leading spaces before each Line?
Thanks for any help!
Jim
--
To unsubscribe, e-ma
2009/12/22 Jim Gibson :
> s/^\.\s*//;
Thanks Jim, I will figure out as I read "learning perl".
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>
--
To unsubscribe, e-mail: beginners-unsubscr
At 11:49 PM -0600 12/21/09, Jim Green wrote:
Hi,
I have a text file with lines like this
· Experience in C/C++ realtime system programming
· Experience in ACE, FIX
Could anybody tell me which regex to use to get rid of the dot and the
leading spaces before each Line?
s/^\.
2009/12/21 Uri Guttman :
>> "JG" == Jim Green writes:
>
> JG> I have a text file with lines like this
>
>
> JG> · Experience in C/C++ realtime system programming
>
> JG> · Experience in ACE, FIX
>
>
> JG> Could anybody tell me which regex to use to get rid of the dot and th
> "JG" == Jim Green writes:
JG> I have a text file with lines like this
JG> · Experience in C/C++ realtime system programming
JG> · Experience in ACE, FIX
JG> Could anybody tell me which regex to use to get rid of the dot and the
JG> leading spaces before each L
Hi,
I have a text file with lines like this
· Experience in C/C++ realtime system programming
· Experience in ACE, FIX
Could anybody tell me which regex to use to get rid of the dot and the
leading spaces before each Line?
Thanks for any help!
Jim
--
To unsubscribe, e-mail
On Nov 9, 2009, at 16:25, axr0284 wrote:
> Hi,
> I am completely stumped with how to proceed with this.
> I have a program where the user inputs a path to a file. This is under
> windows xp
>
> The path can be relative
> ..\..\..\synthesis\int_code.psm
> .\program\synthesis\int_code.psm
>
> or
On Mon, Nov 9, 2009 at 10:25 AM, axr0284 wrote:
> Hi,
> I am completely stumped with how to proceed with this.
> I have a program where the user inputs a path to a file. This is under
> windows xp
>
> The path can be relative
> ..\..\..\synthesis\int_code.psm
> .\program\synthesis\int_code.psm
>
Hi,
I am completely stumped with how to proceed with this.
I have a program where the user inputs a path to a file. This is under
windows xp
The path can be relative
..\..\..\synthesis\int_code.psm
.\program\synthesis\int_code.psm
or absolute
c:\command\tool\program\synthesis\int_code.psm
I do
> "GM" == Gregory Machin writes:
GM> Thanks for the help .. knowing the anchor thing help me. if you not
GM> sure what ur looking for or what it call you end up with the wrong
GM> thing.
did you read my post? if you had a clue about the digits starting at the
beginning of the string, t
Thanks for the help .. knowing the anchor thing help me. if you not
sure what ur looking for or what it call you end up with the wrong
thing.
On Tue, Sep 15, 2009 at 10:21 AM, Tim Bowden wrote:
> On Tue, 2009-09-15 at 10:10 +0200, Gregory Machin wrote:
>> Any numbers, but only 3 digits in the str
On Tue, 2009-09-15 at 10:10 +0200, Gregory Machin wrote:
> Any numbers, but only 3 digits in the string.
>
> I'm filtering out local extention numbers from phone numbers
>
> Where in the log the extension is 104 and the phone number would be
> something like PSTN0/2-0115070545. All the stuff I ha
Any numbers, but only 3 digits in the string.
I'm filtering out local extention numbers from phone numbers
Where in the log the extension is 104 and the phone number would be
something like PSTN0/2-0115070545. All the stuff I have tried have
returned would return both the extension number and 3
On Tue, 2009-09-15 at 09:30 +0200, Gregory Machin wrote:
> Hi
>
> I'm look for code example that will only select a string containing 3
> digits .. The string cant be less than 3 digit , can't be more than 3
> and can't contain any other characters.
>
> I have googled and found code that will fin
> "GM" == Gregory Machin writes:
GM> I'm look for code example that will only select a string containing 3
GM> digits .. The string cant be less than 3 digit , can't be more than 3
GM> and can't contain any other characters.
that is called containing exactly three digits. you spent way
Hi
I'm look for code example that will only select a string containing 3
digits .. The string cant be less than 3 digit , can't be more than 3
and can't contain any other characters.
I have googled and found code that will find 3 consecutive digits
within a string or at the beginning.
Any ideas
: beginners@perl.org
Subject: Re: Simple regex question
You wrote on 05/19/2009 03:18 PM:
> Simple question for the regEXperts out there...
>
> I have a string that is always in the format: a.nn+x.y
>
> a is always 5 chars
> n can be 1 or 2 digits
> x can be +/- (with sign), 1-4
Dan Fish wrote:
Simple question for the regEXperts out there...
I have a string that is always in the format: a.nn+x.y
a is always 5 chars
[a-zA-Z0-9]{5}
n can be 1 or 2 digits
[0-9]{1,2}
x can be +/- (with sign), 1-4 digits
[-+][0-9]{1,4}
y is always positive (no sign), 1
Chas. Owens wrote:
On Tue, May 19, 2009 at 09:55, Alexander Koenig wrote:
snip
($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/;
snip
As of Perl 5.8 \d no longer matches [0-9].
^
As of Perl 5.8 \d no longer matches only [0-9].
Dan Fish wrote:
Simple question for the regEXperts out there...
I have a string that is always in the format: a.nn+x.y
a is always 5 chars
[a-zA-Z0-9]{5}
n can be 1 or 2 digits
[0-9]{1,2}
x can be +/- (with sign), 1-4 digits
[-+][0-9]{1,4}
y is always positive (no sign), 1
On Tue, May 19, 2009 at 10:21, Alexander Koenig wrote:
> Chas. Owens wrote on 05/19/2009 04:02 PM:
>
>>> ($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/;
>> snip
>>
>> As of Perl 5.8 \d no longer matches [0-9]. It now matches any UNICODE
>> character that has the digit propert
Chas. Owens wrote on 05/19/2009 04:02 PM:
>> ($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/;
> snip
>
> As of Perl 5.8 \d no longer matches [0-9]. It now matches any UNICODE
> character that has the digit property. This includes characters such
> as "\x{1815}" (MONGOLIAN DI
> > Simple question for the regEXperts out there...
> >
> > I have a string that is always in the format: a.nn+x.y
> >
> > a is always 5 chars
> > n can be 1 or 2 digits
> > x can be +/- (with sign), 1-4 digits
> > y is always positive (no sign), 1-4 digits
> snip
>
> What do you mean by char
A crude one
($part,$unit,$x,$y,$xlen,$ylen) = ($1,$2,$3,length($4),length($5))
if ($string =~ /(^\S{5})\.(\d{2})([+-])(\d+)\.(\d+)$/);
-Original Message-
From: Dan Fish [mailto:d...@ninemoons.com]
Sent: 19 May 2009 14:18
To: beginners@perl.org
Subject: Simple regex question
Simple
On Tue, May 19, 2009 at 09:55, Alexander Koenig wrote:
snip
> ($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/;
snip
As of Perl 5.8 \d no longer matches [0-9]. It now matches any UNICODE
character that has the digit property. This includes characters such
as "\x{1815}" (MONGO
On Tue, May 19, 2009 at 09:18, Dan Fish wrote:
> Simple question for the regEXperts out there...
>
> I have a string that is always in the format: a.nn+x.y
>
> a is always 5 chars
> n can be 1 or 2 digits
> x can be +/- (with sign), 1-4 digits
> y is always positive (no sign), 1-4 digits
snip
You wrote on 05/19/2009 03:18 PM:
> Simple question for the regEXperts out there...
>
> I have a string that is always in the format: a.nn+x.y
>
> a is always 5 chars
> n can be 1 or 2 digits
> x can be +/- (with sign), 1-4 digits
> y is always positive (no sign), 1-4 digits
The best I ca
Simple question for the regEXperts out there...
I have a string that is always in the format: a.nn+x.y
a is always 5 chars
n can be 1 or 2 digits
x can be +/- (with sign), 1-4 digits
y is always positive (no sign), 1-4 digits
Some examples:
A123C.11+002.001
FC32G.2-1.0
On Wed Mar 25 2009 @ 3:10, Chas. Owens wrote:
> On Wed, Mar 25, 2009 at 13:21, Telemachus wrote:
> snip
> > my $string2 = 'remove-all-this (Keep this) remove this too';
> >
> > $string2 =~ s/.*\((.*)\)/$1/;
> snip
>
> If $string2 may contain more than one pair of parentheses, you will want
On Wed, Mar 25, 2009 at 13:21, Telemachus wrote:
snip
> my $string2 = 'remove-all-this (Keep this) remove this too';
>
> $string2 =~ s/.*\((.*)\)/$1/;
snip
If $string2 may contain more than one pair of parentheses, you will want to say
$string2 =~ s/.*\((.*?)\)/$1/;
or
$string2 =~ s/.*\(
Rick Bragg wrote:
I need a quick regex to strip out the following:
Never heard of that. What is a quick regex?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.o
On Wed Mar 25 2009 @ 12:19, Rodrick Brown wrote:
> On Wed, Mar 25, 2009 at 12:00 PM, Rick Bragg wrote:
> > I need a quick regex to strip out the following:
> >
> > example:
> > change "remove-all-this (Keep This)" into just "Keep This"
> >
>
> $s =~ s/.*\((.*)\)/$1/;
>
> > something like:
> > s/
On Wed, Mar 25, 2009 at 12:00 PM, Rick Bragg wrote:
> I need a quick regex to strip out the following:
>
> example:
> change "remove-all-this (Keep This)" into just "Keep This"
>
$s =~ s/.*\((.*)\)/$1/;
> something like:
> s/ beginning of line up to and including the first ( //g
> s/ starting fr
I need a quick regex to strip out the following:
example:
change "remove-all-this (Keep This)" into just "Keep This"
something like:
s/ beginning of line up to and including the first ( //g
s/ starting from and including first ) to end of line //g
Can anyone help with this quick line or 2?
Than
Chris Knipe wrote:
(Really just need to get $interface name and $signal)...
Then you may prefer a list slice.
my ($interface, $signal) = (split ' ', $Line)[1,5];
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
Chris Knipe wrote:
Paolo Gianrossi wrote:
Could maybe a simple split(/\s+/ $Line, 7); work?
Almost, but we're not *quite* there yet...
...
I'm not sure why I am required to have 9 fields in the split to get the
values now...
It appears from your initial post as if there is a leading space b
Chris Knipe ha scritto:
>>> # INTERFACE
>>> RADIO-NAME MAC-ADDRESS AP SIGNAL-STRENGTH TX-RATE UPTIME
>>> 0 interface_name radio
>>> 00:0C:42:1F:2C:8D yes -63...@18mbps 9Mbps 2h2m38s
>>>
>>> I'm looking for a
>>> foreach my $Line (@
Chris Knipe wrote:
Hi,
Hello,
I have two lines (well, 1 line is headers, then there follows a range of
data)...
# INTERFACE
RADIO-NAME MAC-ADDRESS AP SIGNAL-STRENGTH TX-RATE UPTIME
0 interface_name radio
00:0C:42:1F:2C:8D yes -
> >
> > # INTERFACE
> > RADIO-NAME MAC-ADDRESS AP SIGNAL-STRENGTH TX-RATE UPTIME
> > 0 interface_name radio
> > 00:0C:42:1F:2C:8D yes -63...@18mbps 9Mbps 2h2m38s
> >
> > I'm looking for a
> > foreach my $Line (@Output) {
> > my (
Chris Knipe ha scritto:
> Hi,
>
> I have two lines (well, 1 line is headers, then there follows a range of
> data)...
>
> # INTERFACE
> RADIO-NAME MAC-ADDRESS AP SIGNAL-STRENGTH TX-RATE UPTIME
> 0 interface_name radio
> 00:0C:42:1F:2C
Hi,
I have two lines (well, 1 line is headers, then there follows a range of
data)...
# INTERFACE
RADIO-NAME MAC-ADDRESS AP SIGNAL-STRENGTH TX-RATE UPTIME
0 interface_name radio
00:0C:42:1F:2C:8D yes -63...@18mbps 9Mbps 2h2m38s
Gunwant Singh schreef:
> I have a query regarding regexes.
No, you don't.
> I am to match only one specific word in a wordlist which has only
> those alphabets which it contains and none other than that.
To do that, you can use regexes, but you don't need to.
> My Wordlist contains:
>
> alph
Hi all,
Thanks for all the help provided so far in my earlier queries. I have a
query regarding regexes.
I am to match only one specific word in a wordlist which has only those
alphabets which it contains and none other than that.
For example:
My Wordlist contains:
alpha
alpha1
beta
betaze
John W. Krahn wrote:
} elsif ( $ARGV[0] =~
m/\b2008(0[1-9]|1[12])(0[1-9]|1[0-9]|2[0-9]|3[01])([01][0-9]|2[0-3])\b/
) {
^
So you don't want to test for October?
John
fixed now. thanks!!
} elsif ( $ARGV[0] =~
m/\b2008(0[1-9]|1[012])(0[1-9]|1[0-9]|2[0-9]|3[01])([01][
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
given then ARGV[0] is 2008052803, why woulnd't below regex match them??
2008052803 is a ten digit number.
} elsif ( $ARGV[0] =~ m/\b2008[01][1-31]([01][0-9]|2[0-3])\b/ ) {
Your pattern matches eight digits with a \b word boundary
John W. Krahn wrote:
Richard Lee wrote:
given then ARGV[0] is 2008052803, why woulnd't below regex match them??
2008052803 is a ten digit number.
} elsif ( $ARGV[0] =~ m/\b2008[01][1-31]([01][0-9]|2[0-3])\b/ ) {
Your pattern matches eight digits with a \b word boundary at each end
so it
John W. Krahn wrote:
Richard Lee wrote:
@array = qx#ls -tr $directory/$ARGV[0]*#;
Why not do that directly in perl:
@array = map $_->[0], sort { $a->[1] <=> $b->[1] } map [ $_, -M ],
glob "$directory/$ARGV[0]*";
Sorry, that should be:
@array = map $_->[0], sort { $b->[1] <
Richard Lee wrote:
given then ARGV[0] is 2008052803, why woulnd't below regex match them??
2008052803 is a ten digit number.
} elsif ( $ARGV[0] =~ m/\b2008[01][1-31]([01][0-9]|2[0-3])\b/ ) {
Your pattern matches eight digits with a \b word boundary at each end so
it will never match a ten
given then ARGV[0] is 2008052803, why woulnd't below regex match them??
} elsif ( $ARGV[0] =~ m/\b2008[01][1-31]([01][0-9]|2[0-3])\b/ ) {
@array = qx#ls -tr $directory/$ARGV[0]*#;
#2008052803
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED
Thank you.
On Fri, 25 Apr 2008, J. Peng wrote:
On Fri, Apr 25, 2008 at 12:47 AM, David Nicholas Kayal
<[EMAIL PROTECTED]> wrote:
why is the first one true?
check 'perldoc perlre' :
The following standard quantifiers are recognized:
* Match 0 or more times
\d* me
On Fri, Apr 25, 2008 at 12:47 AM, David Nicholas Kayal
<[EMAIL PROTECTED]> wrote:
>
> why is the first one true?
>
check 'perldoc perlre' :
The following standard quantifiers are recognized:
* Match 0 or more times
\d* means 0 or more numbers.
--
J. Peng - QQMail Op
[EMAIL PROTECTED] quick_test]$ cat test_regex.pl
#!/usr/bin/perl -w
use strict;
my $line = "test_text";
if($line =~ m/^\d*/)
{
print "true\n";
} else {
print "false\n";
}
if($line =~ m/^\d/)
{
print "true\n";
} else {
print "false\n";
}
[EMAIL PROTECTED] quick_t
The primary problem would be that you're match seems a bit backwards.
Try "if ($line =~ m/$file/)" which will cut through any extra formatting
output by dir.
Jim wrote:
> Hi Everyone,
>
> I am trying to match file & subdir names from a back tic generated list.
> I never find anything and there ar
2007/10/11, Jim <[EMAIL PROTECTED]>:
>
> Hi Everyone,
>
> I am trying to match file & subdir names from a back tic generated list.
> I never find anything and there are files in the directory with a correct
> name.
> but if i make up a list to use as filenames
> it works as i expect ... any insight
Hi Everyone,
I am trying to match file & subdir names from a back tic generated list.
I never find anything and there are files in the directory with a correct name.
but if i make up a list to use as filenames
it works as i expect ... any insight greatly appreciated
thanks
Jim
#!/usr/bin/perl
Chas Owens wrote:
> On 5/16/07, Mathew <[EMAIL PROTECTED]> wrote:
> snip
>> What does gr() do?
>>
>> Mathew
>>
>
> qr not gr. It is the quote regex operator.
>
> from perldoc perlop
> qr/STRING/imosx
> This operator quotes (and possibly compiles) its STRING as a
>
Mathew 写道:
What does gr() do?
It's "qr" not "gr".
See "perldoc perlop" and look for "qr/STRING/imosx".
--
http://home.arcor.de/jeffpang/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On 5/16/07, Mathew <[EMAIL PROTECTED]> wrote:
snip
What does gr() do?
Mathew
qr not gr. It is the quote regex operator.
from perldoc perlop
qr/STRING/imosx
This operator quotes (and possibly compiles) its STRING as a
regular expression. STRING is interpola
Chas Owens wrote:
> On 5/16/07, Mathew Snyder <[EMAIL PROTECTED]> wrote:
>> I have a trouble ticket application that uses a regex to find a piece of
>> information in an incoming email and auto populate a field if it is
>> found. The
>> line it will be looking for is
>> CUSTOMER ENVIRONMENT cust
On 5/16/07, Mathew Snyder <[EMAIL PROTECTED]> wrote:
I have a trouble ticket application that uses a regex to find a piece of
information in an incoming email and auto populate a field if it is found. The
line it will be looking for is
CUSTOMER ENVIRONMENT customer_name
where customer_name will
I have a trouble ticket application that uses a regex to find a piece of
information in an incoming email and auto populate a field if it is found. The
line it will be looking for is
CUSTOMER ENVIRONMENT customer_name
where customer_name will never have a space making it one word. If I just want
John W. Krahn writes:
Tom Allison wrote:
How do I pull all the words from a line between the two words 'from' and
'by' when I have NO IDEA what's in there, but I know they are all in one
line.
To make it more difficult. 'by' is optional...
Like this:
from..by..
or
from..
On 5/14/07, Jeff Pang <[EMAIL PROTECTED]> wrote:
snip
Maybe a space following the "by" is needed? :)
snip
This what the word boundary character class is for
perl -le'
for ( "abc from to the word by and the end", "abc from to the end",
"abc from this byebye to this") {
print $1 if /from(.*?(?
Hi,
On May 14, 2007, at 11:50 PM, Tom Allison wrote:
yitzle wrote:
# Requires "by":
$line = "daffromHello Worldby";
$line =~ /from(.*)(by)/;
print $1;
Not sure about making it optional.
Can always check if you got "" and then try without the "by"
the .* pulls in too much.
I'm going to have
John W. Krahn 写道:
$ perl -le'
for ( "abc from to the word by and the end", "abc from to the end" ) {
print $1 if /from(.*?(?=by)|.*)/;
}
'
But this coundn't handle this case:
$string = "abc from to the word byebye...";
Maybe a space following the "by" is needed? :)
--
To unsubscrib
Tom Allison wrote:
> How do I pull all the words from a line between the two words 'from' and
> 'by' when I have NO IDEA what's in there, but I know they are all in one
> line.
>
> To make it more difficult. 'by' is optional...
>
> Like this:
>
> from..by..
> or
> from..
>
> I want
yitzle wrote:
# Requires "by":
$line = "daffromHello Worldby";
$line =~ /from(.*)(by)/;
print $1;
Not sure about making it optional.
Can always check if you got "" and then try without the "by"
the .* pulls in too much.
I'm going to have to back up and try this again.
But I think it's late.
# Requires "by":
$line = "daffromHello Worldby";
$line =~ /from(.*)(by)/;
print $1;
Not sure about making it optional.
Can always check if you got "" and then try without the "by"
On 5/14/07, Tom Allison <[EMAIL PROTECTED]> wrote:
How do I pull all the words from a line between the two words 'f
How do I pull all the words from a line between the two words 'from' and 'by'
when I have NO IDEA what's in there, but I know they are all in one line.
To make it more difficult. 'by' is optional...
Like this:
from..by..
or
from..
I want all the stuff inside.
Initially I'm think
John W. Krahn wrote:
Rob Dixon wrote:
John W. Krahn wrote:
Gauthier, Dave wrote:
Getting unwanted list elements when using split with regex. Here's an
example
$str = "abc=In";
@arr = split(/[a-zA-Z0-9]/,$str);
foreach $a (@arr)
{print "$a\n";}
I get...
<> <> <> <=>
^ ^ ^ ^
"John W. Krahn" schreef:
> split Splits the string EXPR into a list of strings and returns
> that list. By default, empty leading fields are
> preserved,
For which meanings of 'default'?
:)
perl -wle '
$_ = " a b c ";
@x = split;
print scalar @x;
'
3
--
Aff
Rob Dixon wrote:
> John W. Krahn wrote:
>>
>> Gauthier, Dave wrote:
>>>
>>> Getting unwanted list elements when using split with regex. Here's an
>>> example
>>>
>>> $str = "abc=In";
>>> @arr = split(/[a-zA-Z0-9]/,$str);
>>> foreach $a (@arr)
>>> {print "$a\n";}
>>>
>>> I get...
>>>
>>> <> <
John W. Krahn wrote:
>
Gauthier, Dave wrote:
>>
Getting unwanted list elements when using split with regex. Here's an
example
$str = "abc=In";
@arr = split(/[a-zA-Z0-9]/,$str);
foreach $a (@arr)
{print "$a\n";}
I get...
<>
<>
<>
<=>
If I change "abc=In" to "abcdef=In", I get 6 un
Gauthier, Dave wrote:
> Getting unwanted list elements when using split with regex. Here's an
> example
>
> $str = "abc=In";
> @arr = split(/[a-zA-Z0-9]/,$str);
> foreach $a (@arr)
> {print "$a\n";}
>
> I get...
>
> <>
> <>
> <>
> <=>
>
> If I change "abc=In" to "abcdef=In", I get 6 u
1 - 100 of 289 matches
Mail list logo