Rob Coops wrote:
> On Tue, Nov 18, 2008 at 9:52 AM, howa <[EMAIL PROTECTED]> wrote:
>
>> Hello,
>>
>> I have two strings:
>>
>> 1. abc
>> 2. abc&
>>
>>
>> The line of string might end with "&" or not, so I use the expression:
>>
>> (.*)[$&]
>>
>> Why it didn't work out?
>
> This does not work bec
Hello
On Nov 18, 8:18 pm, [EMAIL PROTECTED] (Rob Coops) wrote:
> If you want to capture both lines you end up doing
> somehting like this: (.*)&{0,1}$
Thanks.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Tue, Nov 18, 2008 at 07:19, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote:
snip
> Inside the [] the meta-character loose their meaning. Only ^ and - have
> special meaning. You have to use | instead.
snip
You missed \, ], and the regex delimiter (default /, but could be
nearly anything). Also
howa wrote:
Hello,
Hello,
I have two strings:
1. abc
2. abc&
The line of string might end with "&" or not, so I use the expression:
(.*)[$&]
Why it didn't work out?
$ perl -le'
for ( "abc", "abc&" ) {
print;
print $1 if /(.*)[$&]/;
}
'
abc
Unmatched [ in regex; marked by <
> -Original Message-
> From: Stewart Anderson
> Sent: 18 November 2008 12:20
> To: beginners@perl.org
> Cc: Stewart Anderson
> Subject: RE: Regular expression problem
>
> > -Original Message-
> > From: howa [mailto:[EMAIL PROTECTED]
> &
> -Original Message-
> From: howa [mailto:[EMAIL PROTECTED]
> Sent: 18 November 2008 08:53
> To: beginners@perl.org
> Subject: Regular expression problem
>
> Hello,
>
> I have two strings:
>
> 1. abc
> 2. abc&
>
>
> The line of string might end with "&" or not, so I use the expression:
On Tue, 2008-11-18 at 00:52 -0800, howa wrote:
> Hello,
>
> I have two strings:
>
> 1. abc
> 2. abc&
>
>
> The line of string might end with "&" or not, so I use the expression:
>
> (.*)[$&]
>
>
> Why it didn't work out?
Inside the [] the meta-character loose their meaning. Only ^ and - ha
On Tue, Nov 18, 2008 at 9:52 AM, howa <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have two strings:
>
> 1. abc
> 2. abc&
>
>
> The line of string might end with "&" or not, so I use the expression:
>
> (.*)[$&]
>
>
> Why it didn't work out?
>
>
> Thanks.
>
>
> --
> To unsubscribe, e-mail: [EMAIL PRO
On Aug 1, 9:28 am, [EMAIL PROTECTED] wrote:
> I'm trying to substitute all comma separated numbers in a text file
> with the same numbers without commas. This expression will match the
> numbers: \d{1,3}?(,\d\d\d)+ but how do i refer to each 3 digit block
> after the commas so i can substitute for
John W. Krahn wrote:
[EMAIL PROTECTED] wrote:
I'm trying to substitute all comma separated numbers in a texv dile
with the same numbers without commas. This expression will match the
numbers: \d{1,3}?(,\d\d\d)+ but how do i refer to each 3 digit block
after the commas so i can substitute for th
[EMAIL PROTECTED] wrote:
I'm trying to substitute all comma separated numbers in a texv dile
with the same numbers without commas. This expression will match the
numbers: \d{1,3}?(,\d\d\d)+ but how do i refer to each 3 digit block
after the commas so i can substitute for them? $1 here just retu
[EMAIL PROTECTED] wrote:
>
> I'm trying to substitute all comma separated numbers in a text file
> with the same numbers without commas. This expression will match the
> numbers: \d{1,3}?(,\d\d\d)+ but how do i refer to each 3 digit block
> after the commas so i can substitute for them? $1 here j
Try looking up the 'g' modifier for regular expressions.
http://perldoc.perl.org/perlre.html
On Fri, Aug 1, 2008 at 10:28 AM, <[EMAIL PROTECTED]> wrote:
> I'm trying to substitute all comma separated numbers in a text file
> with the same numbers without commas. This expression will match the
>
>
> [EMAIL PROTECTED] wrote:
>> Mr. Shawn H. Corey wrote:
>> > [EMAIL PROTECTED] wrote:
>> > > Morning All,
>> > >
>> > > I've a relatively minor problem that has been giving me a headache
>> for
>> > > several days. I know there are many other ways to do this, however
>> I'd
>> > > like to know wh
[EMAIL PROTECTED] wrote:
> Mr. Shawn H. Corey wrote:
> > [EMAIL PROTECTED] wrote:
> > > Morning All,
> > >
> > > I've a relatively minor problem that has been giving me a headache for
> > > several days. I know there are many other ways to do this, however I'd
> > > like to know why this isn't wor
[EMAIL PROTECTED] wrote:
> Mr. Shawn H. Corey wrote:
> > [EMAIL PROTECTED] wrote:
> > > Morning All,
> > >
> > > I've a relatively minor problem that has been giving me a headache for
> > > several days. I know there are many other ways to do this, however I'd
> > > like to know why this isn't wor
On Aug 10, 8:28 am, [EMAIL PROTECTED] wrote:
> I ought clarify.
No, you ought to post a short-but-complete script to start with, and
not assume you know what one specific line of the program is causing
problems.
> It's not a problem with the command line, or anything like that, it's
> a problem w
On Aug 10, 9:27 am, [EMAIL PROTECTED] (Oryann9) wrote:
> Another hunch looking at your syntax, ideally you
> should be using the lesser precedence operator 'and'
> instead of the higher precedence operator '&&'. Yes
> plz show the command line string. :)
>
> if($ARGV[2] =~ /port/i and $ARGV[3] =~ /
Mr. Shawn H. Corey wrote:
> [EMAIL PROTECTED] wrote:
> > Morning All,
> >
> > I've a relatively minor problem that has been giving me a headache for
> > several days. I know there are many other ways to do this, however I'd
> > like to know why this isn't working. The snippet of code in question
>
> > like to know why this isn't working. The snippet
> of code in question
> > is as follows
> >
> >
> > if($ARGV[2] =~ /port/i && $ARGV[3] =~ /nick/i)
> > {
> >
>
> Well, on a hunch I'd say that snippet returns false
> because either
> $ARGV[2] doesn't match /port/i, or because $ARGV[3]
> doe
On Aug 10, 6:26 am, [EMAIL PROTECTED] wrote:
> Morning All,
>
> I've a relatively minor problem that has been giving me a headache for
> several days. I know there are many other ways to do this, however I'd
> like to know why this isn't working. The snippet of code in question
> is as follows
>
>
[EMAIL PROTECTED] wrote:
Morning All,
I've a relatively minor problem that has been giving me a headache for
several days. I know there are many other ways to do this, however I'd
like to know why this isn't working. The snippet of code in question
is as follows
if($ARGV[2] =~ /port/i && $ARGV
FastEthernet3/9
lifEntry.20.13 = administratively down
*
Thanks
Rajeev
-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 05, 2003 8:21 PM
To: [EMAIL PROTECTED]
Subject: Re: Regular expression problem.
Pandey Rajeev-A19514 wrote:
On Jul 5, Pandey Rajeev-A19514 said:
>***
> ifEntry.1.13 = 13
> ifEntry.2.13 = FastEthernet3/9
> ifEntry.3.13 = 6
> lifEntry.20.13 = administratively down
>Jul 5 03:22:33.851 cst: SNMP: Queuing packet to 10.3.0.1
>Jul 5 03:22:33.851 cst
Pandey Rajeev-A19514 wrote:
> Hi,
>
> Can anyone give me a regular expression(perhaps a one liner) ?
> Matching an expression in a single line is easy. But if I have to find it out in a
> array of scalars, it becomes tricky for me.
>
> An excerpt of my output buffer looks like this.
>
25 matches
Mail list logo