Re: Regular expression problem

2008-11-19 Thread Rob Dixon
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

Re: Regular expression problem

2008-11-19 Thread howa
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/

Re: Regular expression problem

2008-11-18 Thread Chas. Owens
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

Re: Regular expression problem

2008-11-18 Thread John W. Krahn
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 <

RE: Regular expression problem

2008-11-18 Thread Stewart Anderson
> -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] > &

RE: Regular expression problem

2008-11-18 Thread Stewart Anderson
> -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:

Re: Regular expression problem

2008-11-18 Thread Mr. Shawn H. Corey
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

Re: Regular expression problem

2008-11-18 Thread Rob Coops
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

Re: regular expression problem

2008-08-03 Thread jordilin
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

Re: regular expression problem

2008-08-02 Thread John W. Krahn
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

Re: regular expression problem

2008-08-02 Thread John W. Krahn
[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

Re: regular expression problem

2008-08-02 Thread Rob Dixon
[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

Re: regular expression problem

2008-08-02 Thread Rob Coops
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 >

Re: Regular Expression Problem

2007-08-10 Thread rcook
> > [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

Re: Regular Expression Problem

2007-08-10 Thread themachinator
[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

Re: Regular Expression Problem

2007-08-10 Thread themachinator
[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

Re: Regular Expression Problem

2007-08-10 Thread Paul Lalli
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

Re: Regular Expression Problem

2007-08-10 Thread Paul Lalli
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] =~ /

Re: Regular Expression Problem

2007-08-10 Thread themachinator
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 >

Re: Regular Expression Problem

2007-08-10 Thread oryann9
> > 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

Re: Regular Expression Problem

2007-08-10 Thread Paul Lalli
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 > >

Re: Regular Expression Problem

2007-08-10 Thread Mr. Shawn H. Corey
[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

RE: Regular expression problem.

2003-07-06 Thread Pandey Rajeev-A19514
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:

Re: Regular expression problem.

2003-07-05 Thread Jeff 'japhy' Pinyan
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

Re: Regular expression problem.

2003-07-05 Thread Rob Dixon
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. >