RE: Inplace edit regex fun

2003-10-08 Thread Dan Muey
> 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

RE: Inplace edit regex fun

2003-10-08 Thread david
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

RE: Inplace edit regex fun

2003-10-08 Thread Dan Muey
> 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

Re: Inplace edit regex fun

2003-10-08 Thread Casey West
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

Inplace edit regex fun

2003-10-08 Thread Dan Muey
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

Re: regex fun :)

2003-03-05 Thread John W. Krahn
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

Re: regex fun :)

2003-03-05 Thread Wiggins d'Anconia
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

Re: regex fun :)

2003-03-05 Thread Wiggins d'Anconia
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

regex fun :)

2003-03-05 Thread jdavis
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