> qx interpolates variables. by the time $1 gets to perl, it's
> already gone.
> try:
>
> print qx(perl -pi -e 's/^$u:hello:([^:]*):/$u:goodbye:\$1/;' file);
>
That did it! Thanks a million for pointing that out!
> why not simply:
>
> [panda]$ perl -pi -e
> 's/^datax:hello:([^:]*):/datax:go
Dan Muey wrote:
>> First, (.*) is very greedy. You might want to limit it in
>> some way, possibly with a ? modifier like (.*?), possibly by
>> looking for less than . such as ([^:]*) -- anything but a colon.
>>
>> Second, the backwack numbers \1 .. \9 are only for the
>> matching portion of a s
> First, (.*) is very greedy. You might want to limit it in
> some way, possibly with a ? modifier like (.*?), possibly by
> looking for less than . such as ([^:]*) -- anything but a colon.
>
> Second, the backwack numbers \1 .. \9 are only for the
> matching portion of a subsitution. You mus
It was Wednesday, October 08, 2003 when Dan Muey took the soap box, saying:
: Howdy list:
:
: Trying to do an inplace edit:
:
: perl -pi -e 's/whatever/newstuff/;' /file/path/here
:
: What I need to do is replace certain parts of the line for instance:
:
:
: s/^$var:(.*):123:def/$var:\1:456:g
Howdy list:
Trying to do an inplace edit:
perl -pi -e 's/whatever/newstuff/;' /file/path/here
What I need to do is replace certain parts of the line for instance:
s/^$var:(.*):123:def/$var:\1:456:ghi/;
Soo if a line matches the $var at the beginning a colon, some stuff, a colon, 123, a
colo
Jdavis wrote:
>
> hello,
Hello,
> while trying to get a grasp on regex
> i found this nice little tutorial.
> http://www.steve.gb.com/perl/lesson06.html
>
> so i tried this..
>
> $choice = 11
> if($choice =~ /[1-6]{1}/)
[1-6]{1} is a more verbose way of saying [1-6]. {1} is implied with
eve
jdavis wrote:
hello,
while trying to get a grasp on regex
i found this nice little tutorial.
http://www.steve.gb.com/perl/lesson06.html
p.s. you may want to have a look at:
perldoc perlretut
perldoc perlre
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional command
jdavis wrote:
hello,
while trying to get a grasp on regex
i found this nice little tutorial.
http://www.steve.gb.com/perl/lesson06.html
so i tried this..
$choice = 11
if($choice =~ /[1-6]{1}/)
this returns true. I want it to only match
a single digit ranging 1-6 , I thought
the {1} would speci
hello,
while trying to get a grasp on regex
i found this nice little tutorial.
http://www.steve.gb.com/perl/lesson06.html
so i tried this..
$choice = 11
if($choice =~ /[1-6]{1}/)
this returns true. I want it to only match
a single digit ranging 1-6 , I thought
the {1} would specifiy to match o