Re: Request for regex: Strip last dash in a record

2005-02-15 Thread Ken Simon
[EMAIL PROTECTED] wrote: If you just want to remove the last occuring '-' character, then the following would work. s/(.*)-(.*)/$1$2/; Well, huh. That does work. Though it reminds me only of how little I understand why. Thanks, you've made it look easy. His regex works because perl uses greedy

Re: Request for regex: Strip last dash in a record

2005-02-15 Thread Peter_Farrar
> >If you just want to remove the last occuring '-' character, then the >following would work. > >s/(.*)-(.*)/$1$2/; Well, huh. That does work. Though it reminds me only of how little I understand why. Thanks, you've made it look easy. ** CONFIDENTIALITY NOTICE ** NOTICE: This e-m

Re: Request for regex: Strip last dash in a record

2005-02-15 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi All, Hello, The code below does what I want to do, but it takes 3 lines and a temporary array (yuck). It does? Could you please explain what exactly you want to do? Just going by your subject line, this will work (assuming $_ contains the data.) s/(.*)-/$1/; I can't c

RE: Request for regex: Strip last dash in a record

2005-02-15 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote: >> [EMAIL PROTECTED] wrote: >> >>> Hi All, >>> >>> The code below does what I want to do, but it takes 3 lines and a >>> temporary array (yuck). I can't come up with a one line regex >>> substitution. Anyone got one? >>> >>> my $tmp = reverse split //, $_; >>> $tmp =~

Re: Request for regex: Strip last dash in a record

2005-02-15 Thread Ankur Gupta
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi All, The code below does what I want to do, but it takes 3 lines and a temporary array (yuck). I can't come up with a one line regex substitution. Anyone got one? my $tmp = reverse split //, $_; $tmp =~ s/-//; $_ = rever

Re: Request for regex: Strip last dash in a record

2005-02-15 Thread Peter_Farrar
>[EMAIL PROTECTED] wrote: > >>Hi All, >> >>The code below does what I want to do, but it takes 3 lines and a temporary >>array (yuck). I can't come up with a one line regex substitution. Anyone >>got one? >> >>my $tmp = reverse split //, $_; >>$tmp =~ s/-//; >>$_ = reverse split //, $tmp; > >can

Request for regex: Strip last dash in a record

2005-02-15 Thread Peter_Farrar
Hi All, The code below does what I want to do, but it takes 3 lines and a temporary array (yuck). I can't come up with a one line regex substitution. Anyone got one? my $tmp = reverse split //, $_; $tmp =~ s/-//; $_ = reverse split //, $tmp; TIA, Peter ** CONFIDENTIALITY NOTICE ** N