Re: Regex to remove zeros after . in file name

2007-11-13 Thread Dr.Ruud
Gunnar Hjalmarsson schreef: > 1. Why is rewriting so bad? Personally I need to look up those > extended patterns, and letting the s/// operator rewrite a single dot > is easier to read IMO. That is exactly why I suggested that the 5.10.x regex-optimiser should take care of that. But only if it pa

Re: Regex to remove zeros after . in file name

2007-11-13 Thread Gunnar Hjalmarsson
Dr.Ruud wrote: Gunnar Hjalmarsson schreef: danlamb: I need a regex to remove zeros after the . in a file name if they are followed by another digit. Example: XX.001 becomes XX.1 s/\.0+(?=[1-9])/./; That rewrites the dot, and won't handle ".000". I would write it like s

Re: Regex to remove zeros after . in file name

2007-11-13 Thread Dr.Ruud
Gunnar Hjalmarsson schreef: > danlamb: >> I need a regex to remove zeros after the . in a file name if they are >> followed by another digit. >> >> Example: XX.001 becomes XX.1 > > s/\.0+(?=[1-9])/./; That rewrites the dot, and won't handle ".000". I would write it like s/(?

Re: Regex to remove zeros after . in file name

2007-11-13 Thread danlamb
On Nov 12, 7:51 pm, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: > s/\.0+(?=[1-9])/./; Thank you Gunnar. This did exactly what I needed. Dan Lamb -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Regex to remove zeros after . in file name

2007-11-12 Thread Ashok Varma
s/\.0+(\d+)/\.\1/; The above substitution works. Ashok On 11/13/07, danlamb <[EMAIL PROTECTED]> wrote: > > Hey guys, > > I need a regex to remove zeros after the . in a file name if they are > followed by another digit. > > Example: XX.001 becomes XX.1 > > Any ideas? I've been banging

Re: Regex to remove zeros after . in file name

2007-11-12 Thread Gunnar Hjalmarsson
danlamb wrote: I need a regex to remove zeros after the . in a file name if they are followed by another digit. Example: XX.001 becomes XX.1 s/\.0+(?=[1-9])/./; -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For