--- 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
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
>> $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
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
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
>
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
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:
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"
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
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_
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"
$tmp =~ /^\w+_/
$tmp = $';
but that results in $tmp e
11 matches
Mail list logo