Regexp - missing matches
I have the following regexp: @matches = $params{f} =~ /(%[aAbBcCdDehHIjmMnprStTuUVwWyY%])/g; If I have a script: [snip] my @matches; my ( %params ); getopts('DRSa:f:s:d:r:b:w:n:h?', \%params); print $params{f}\n; print @matches\n; [snip] I am passing -f some string in on the command line. $params{f} = %E %e %d; output: %E %e %d %d So %e is not found $params{f} = %d %e; output: %d %e %e And now no %d. Any ideas why the first match is being lost ? - Craig Moynes [EMAIL PROTECTED]
Re: Regexp - missing matches
On Fri, May 25, 2001 at 11:43:21AM -0400, Craig Moynes/Markham/IBM wrote: I have the following regexp: @matches = $params{f} =~ /(%[aAbBcCdDehHIjmMnprStTuUVwWyY%])/g; If I have a script: [snip] my @matches; my ( %params ); getopts('DRSa:f:s:d:r:b:w:n:h?', \%params); print $params{f}\n; print @matches\n; [snip] I am passing -f some string in on the command line. $params{f} = %E %e %d; output: %E %e %d %d So %e is not found $params{f} = %d %e; output: %d %e %e And now no %d. Any ideas why the first match is being lost ? You must be doing something in the parts you snipped that effects @matches. I wrote the following code: my @matches; my ( %params ); $params{f} = %E %e %d; @matches = $params{f} =~ /(%[aAbBcCdDehHIjmMnprStTuUVwWyY%])/g; print $params{f}\n; print @matches\n; And my output was: %E %e %d %e %d Looks fine to me... Walt -- Walter C. Mankowski Senior Software EngineerMyxa Corporation phone: (610) 234-2626 fax: (610) 234-2640 email: [EMAIL PROTECTED]http://www.myxa.com
Re: Regexp - missing matches
Craig Moynes wrote: : $params{f} = %E %e %d; : output: : %E %e %d : %d : : So %e is not found : : $params{f} = %d %e; : output: : %d %e : %e I can't reproduce this error with the code you posted. Here's the script I tried: #!/faxafloi/data1/bin/perl use Getopt::Std; use strict; my @matches; my ( %params ); getopts('DRSa:f:s:d:r:b:w:n:h?', \%params); @matches = $params{f} =~ /(%[aAbBcCdDehHIjmMnprStTuUVwWyY%])/g; print $params{f}\n; print @matches\n; With a command line of -f '%E %e %d' I get an output of %e %d -- tdk