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 instances of a

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)/bx;1$1ba/g; print $s;

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)/bx;1$1ba/g; print $s; I get bx;1144 cmba what do you get?

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)/bx;1$1ba/g; print $s; I get bx;1144 cmba

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)/bx;1$1ba/g; print $s; I get bx;1144

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)/bx;1$1ba/g; Input string: 144 cm Output string: bx;114bx;14 cmbaba Why

Find all matches in a string via regex

2006-10-25 Thread C. Roberts
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 cm together by changing it to bx;121 cmba. My problem

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 cm

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)/bx;1$1ba/g; Input string: 144 cm Output string: bx;114bx;14 cmbaba Why did I get duplicate bx;1 and ba strings? Is the \G operator here and does v5.6.1 have it? Chuck -- To

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 (DATA) { s/(\d+\s+cm)/bx;1$1ba/g; print; } __DATA__ 54 x 34 x 30-3/4 Hl137 x 86 x 78 cmlKneehole Height: 24-1/2`` (62 cm)lChair height: 30-3/4 (78 cm)l 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 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)/bx;1$1ba/g; Input string: 144 cm Output string: bx;114bx;14 cmbaba Why did I get duplicate bx;1 and ba strings? Hm, I can't reproduce this