Lyle Kopnicky wrote:
Craig Cardimon wrote:
I'm looking for patterns where the sign "%" or the word "percent" are
preceded by a group of one or more digits and zero or more spaces.
if( $line =~ /\%|\bpercent\b/i )
{
if( $line =~ /\d+\s*(\%|\bpercent\b/i )
{
# magic happens
}
}
The outer if is redundant. It will only match more lines, which will
slow down your program.
Your parentheses are mismatched in the inner if. Try:
if( $line =~ /\d+\s*(\%|\bpercent\b)/i )
{
# magic happens
}
Note that you will not match "43percent", since there is no word
boundary between "43" and "percent".
Thank you. It helps to have another pair of eyes look at these pesky
RegExes.
-- Craig
---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0616-4, 04/21/2006
Tested on: 4/21/2006 7:48:10 AM
avast! - copyright (c) 1988-2004 ALWIL Software.
http://www.avast.com
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs