Re: regexp trouble

2001-05-07 Thread Paul
--- Tony Cook <[EMAIL PROTECTED]> wrote: > On Mon, 7 May 2001, Johan Groth wrote: > > I want to strip a variable of all characters including a token, > > aaa_bbb_ccc_ddd would become bbb_ccc_ddd. > > . . . > > I've tried: > > $tmp = "aaa_bbb_ccc_ddd" > > $tmp =~ /^\w+_/ > > $tmp = $'; > > but th

Re: regexp trouble

2001-05-07 Thread Brett W. McCoy
On Mon, 7 May 2001, Jeff Pinyan wrote: > You're also using \2 on the right-hand side (RHS) of a s///, which is not > safe. You should use $2. > > s/^[A-Za-z]+_//; > > does far less work. Yeah, I realized that after I already sent the reply. It's what I get for popping off replies with insuff

Re: regexp trouble

2001-05-07 Thread Jeff Pinyan
>> $tmp =~ s/^([A-Za-z]+_)(.*)/\2/; >> >> I think the problem is that \w matches an underscore also, and the regexp >> is being greedy as well. There's probably an even better way to do it >> (especially if your strings have foreign characters at it), but that was >> what occurred to me off the t

Re: regexp trouble

2001-05-07 Thread Jeff Pinyan
On May 7, Johan Groth said: >I want to strip a variable of all characters including a token, i.e. >aaa_bbb_ccc_ddd would become bbb_ccc_ddd. As you can see I want to get rid of >aaa_. Does anyone know how to acomplish this in Perl? > >I've tried: >$tmp = "aaa_bbb_ccc_ddd" >$tmp =~ /^\w+_/ >$tmp

Re: regexp trouble

2001-05-07 Thread Dale Owens
ROTECTED]> Sent: Monday, May 07, 2001 9:32 AM Subject: Re: regexp trouble > On Mon, 7 May 2001, Johan Groth wrote: > > > I want to strip a variable of all characters including a token, i.e. > > aaa_bbb_ccc_ddd would become bbb_ccc_ddd. As you can see I want to get rid of >

Re: regexp trouble

2001-05-07 Thread Brett W. McCoy
On Mon, 7 May 2001, Johan Groth wrote: > I want to strip a variable of all characters including a token, i.e. > aaa_bbb_ccc_ddd would become bbb_ccc_ddd. As you can see I want to get rid of > aaa_. Does anyone know how to acomplish this in Perl? > > I've tried: > $tmp = "aaa_bbb_ccc_ddd" > $tmp

Re: regexp trouble

2001-05-07 Thread Johan Groth
Tony Cook wrote: > [snip] > > or by literally choosing the characters you want to match (preferably > using ranges): > >$tmp =~ s/^[a-z0-9]+_//i; Thank you! That did the trick. /Johan -- Johan Groth (xghjn) ! Tel. mobil: 0703 - 24 25 27 Cell Network! Kontoret:

Re: regexp trouble

2001-05-07 Thread Tony Cook
On Mon, 7 May 2001, Johan Groth wrote: > Hi, > I want to strip a variable of all characters including a token, i.e. > aaa_bbb_ccc_ddd would become bbb_ccc_ddd. As you can see I want to get rid of > aaa_. Does anyone know how to acomplish this in Perl? > > I've tried: > $tmp = "aaa_bbb_ccc_ddd"

Re: regexp trouble

2001-05-07 Thread Johan Groth
Andrew Teo wrote: > > try this : > $tmp =~ tr/a/ /; I see I need to be a bit more specific. The above would change the a's to spc but what I want is to strip the string of all characters up to and including the first underscore. Ie aaa_bbb_ccc would become bbb_ccc and sometext_more_text would be

Re: regexp trouble

2001-05-07 Thread Andrew Teo
try this : $tmp =~ tr/a/ /; Johan Groth wrote: > > Hi, > I want to strip a variable of all characters including a token, i.e. > aaa_bbb_ccc_ddd would become bbb_ccc_ddd. As you can see I want to get rid of > aaa_. Does anyone know how to acomplish this in Perl? > > I've tried: > $tmp = "aaa_