Re: Find all matches in a string via regex

2006-11-06 Thread C . R .
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > > > My first post in this thread shows example data as it is stored in a > > scalar variable. It also shows what the string SHOULD look like after > > the substitution. > > > > Or maybe, perl simply is not able to replace multiple in

Re: Find all matches in a string via regex

2006-11-01 Thread D. Bolliger
C.R. am Dienstag, 31. Oktober 2006 17:20: > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > > > You need to show us your code Chuck. Perl doesn't do that, in any > > situation that I can think of. Try running this on its own: > > > > my $s = '144 cm'; > > $s =~ s/(\d+ +cm)/$1/g; > > pri

Re: Find all matches in a string via regex

2006-10-31 Thread Mumia W.
On 10/31/2006 10:20 AM, C.R. wrote: In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... You need to show us your code Chuck. Perl doesn't do that, in any situation that I can think of. Try running this on its own: my $s = '144 cm'; $s =~ s/(\d+ +cm)/$1/g; print $s; I get 144 cm what do

Re: Find all matches in a string via regex

2006-10-31 Thread Rob Dixon
Chuck Roberts wrote: > > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... >> >> You need to show us your code Chuck. Perl doesn't do that, in any situation >> that I can think of. Try running this on its own: >> >> my $s = '144 cm'; >> $s =~ s/(\d+ +cm)/$1/g; >> print $s; >> >> I get >> >

Re: Find all matches in a string via regex

2006-10-31 Thread C . R .
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > You need to show us your code Chuck. Perl doesn't do that, in any situation > that > I can think of. Try running this on its own: > > my $s = '144 cm'; > $s =~ s/(\d+ +cm)/$1/g; > print $s; > > I get > > 144 cm > > what do you get? >

Re: Find all matches in a string via regex

2006-10-27 Thread Rob Dixon
C.R. wrote: > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] > says... >> C.R. am Mittwoch, 25. Oktober 2006 20:38: >>> Well, that kinda worked. I had to change it to work on a scalar so this >>> is what I wrote: >>> $s=~s/(\d+ +cm)/$1/g; >>> >>> Input string: 144 cm >>> Output string: 144 cm >

Re: Find all matches in a string via regex

2006-10-27 Thread C . R .
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > C.R. am Mittwoch, 25. Oktober 2006 20:38: > > Well, that kinda worked. I had to change it to work on a scalar so this > > is what I wrote: > > $s=~s/(\d+ +cm)/$1/g; > > > > Input string: 144 cm > > Output string: 144 cm > > > > Why did I

Re: Find all matches in a string via regex

2006-10-25 Thread D. Bolliger
C.R. am Mittwoch, 25. Oktober 2006 20:38: > Well, that kinda worked. I had to change it to work on a scalar so this > is what I wrote: > $s=~s/(\d+ +cm)/$1/g; > > Input string: 144 cm > Output string: 144 cm > > Why did I get duplicate and strings? Hm, I can't reproduce this (perl 5.8.8): $ per

Re: Find all matches in a string via regex

2006-10-25 Thread Dr.Ruud
"D. Bolliger" schreef: > #!/usr/bin/perl > use strict; > use warnings; > > while () { > s/(\d+\s+cm)/$1/g; > print; > } > > __DATA__ > 54 x 34 x 30-3/4 H137 x 86 x 78 cmKneehole Height: 24-1/2`` (62 > cm)Chair height: 30-3/4 (78 cm) If "cm" can be wrapped to the next line, either slurp or use

Re: Find all matches in a string via regex

2006-10-25 Thread C . R .
Well, that kinda worked. I had to change it to work on a scalar so this is what I wrote: $s=~s/(\d+ +cm)/$1/g; Input string: 144 cm Output string: 144 cm Why did I get duplicate and strings? Is the \G operator here and does v5.6.1 have it? Chuck -- To unsubscribe, e-mail: [EMAIL PROTECTE

Re: Find all matches in a string via regex

2006-10-25 Thread D. Bolliger
C. Roberts am Mittwoch, 25. Oktober 2006 19:32: > I have Perl 5.6.1 on Sun Solaris. > > I am processing a text file which will be imported into our > typesetting software. In our typesetting software I want to make > sure a number does not separate from its unit of measure. So I want > to keep "21