Re: Question about pattern matching

2006-04-21 Thread Craig Cardimon
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

Re: Question about pattern matching

2006-04-20 Thread Lyle Kopnicky
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 re

Question about pattern matching

2006-04-20 Thread Craig Cardimon
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 } } Am I on the right track here? In the tex

Re: Pattern matching

2006-03-04 Thread Chris Wagner
Ok I figured it out. The eval has to output a legal argument for print(). The previous version didn't work because print $x $y is invalid. U need print "$x $y". $x = "a"; $y = "b"; $z = '$x $y'; print eval "\"$z\""; ## a b -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911

Re: Pattern matching

2006-03-04 Thread $Bill Luebkert
Jim Hill wrote: > $Bill Luebkert wrote: > >>The eval already suggested by Chris should work > > It doesn't, unfortunately, unless I'm mishandling it in some way. Try this one: use strict; use warnings; my %ini; my $inifile = 'test.ini'; make_ini ($inifile); read_ini ($inifile); print Data::

Re: Pattern matching

2006-03-04 Thread Chris Wagner
At 01:07 PM 3/2/2006 +, Jim Hill wrote: >> I would try print eval $ini{section}{match}. > >Sorry, I should have mentioned that I've tried that ... Desperation time. ;) $x = "a"; $y = "b"; $z = '$x $y'; ($m1, $m2) = $z =~ m/\$(.+)\s\$(.+)/; print "$$m1 $$m2"; ## a b -- REMEMBER TH

Re: Pattern matching

2006-03-03 Thread Jim Hill
Thomas, Mark - BLS CTR in <[EMAIL PROTECTED]>: > > > > > Jim Hill wrote: > > > > > > > > > > > | $ini{section}{match} = '$1 $2'; > > > > > > ... however that just prints "$1 $2" as a literal string. > > > > > > > > > > Hint: the above two lines of your post answer your own question. > > > > > >

RE: Pattern matching

2006-03-03 Thread Thomas, Mark - BLS CTR
> Thomas, Mark in > <[EMAIL PROTECTED]>: > > > From: Jim Hill [mailto:[EMAIL PROTECTED] > > > Thomas, Mark in > <[EMAIL PROTECTED]>: > > > > Jim Hill wrote: > > > > > > > > > | $ini{section}{match} = '$1 $2'; > > > > > ... however that just prints "$1 $2" as a literal string. > > > > > > > > Hi

RE: Pattern matching

2006-03-03 Thread Thomas, Mark - BLS CTR
Jim Hill wrote: > | $ini{section}{match} = '$1 $2'; > ... however that just prints "$1 $2" as a literal string. Hint: the above two lines of your post answer your own question. :-) - Mark. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.A

Re: Pattern matching

2006-03-03 Thread Jim Hill
Thomas, Mark in <[EMAIL PROTECTED]>: > Jim Hill wrote: > > > | $ini{section}{match} = '$1 $2'; > > ... however that just prints "$1 $2" as a literal string. > > Hint: the above two lines of your post answer your own question. Do they? That doesn't help me, I'm afraid. I've been struggling with t

Re: Pattern matching

2006-03-03 Thread Jim Hill
Thomas, Mark - BLS CTR in <[EMAIL PROTECTED]>: > Glad you got it... I didn't realize you *wanted* the '$1 $2' to be > *stored* as a literal string. There's the rub, neither did I. -- ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveS

Re: Pattern matching

2006-03-03 Thread Jim Hill
$Bill Luebkert wrote: > Jim Hill in <[EMAIL PROTECTED]>: > > > I have a log analysis script to which I'm trying to add a pattern > > matching option. [snip] > > The eval already suggested by Chris should work It doesn't, unfortunately, unless I'm m

Re: Pattern matching

2006-03-03 Thread Jim Hill
Thomas, Mark in <[EMAIL PROTECTED]>: > > From: Jim Hill [mailto:[EMAIL PROTECTED] > > Thomas, Mark in <[EMAIL PROTECTED]>: > > > Jim Hill wrote: > > > > > > > | $ini{section}{match} = '$1 $2'; > > > > ... however that just prints "$1 $2" as a literal string. > > > > > > Hint: the above two lines

Re: Pattern matching

2006-03-03 Thread Jim Hill
Chris Wagner in <[EMAIL PROTECTED]>: > At 12:07 AM 3/2/2006 +, perl-win32-users@listserv.ActiveState.com wrote: > > | print $ini{section}{match}; > > > >... however that just prints "$1 $2" as a literal string. > > I would try print eval $ini{section}{match}. Sorry, I should have mentioned t

Re: Pattern matching

2006-03-01 Thread Chris Wagner
At 12:07 AM 3/2/2006 +, perl-win32-users@listserv.ActiveState.com wrote: >| print $ini{section}{match}; > >... however that just prints "$1 $2" as a literal string. I would try print eval $ini{section}{match}. -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede malis

Pattern matching

2006-03-01 Thread Jim Hill
Hi all I have a log analysis script to which I'm trying to add a pattern matching option. The script is controlled via the contents of an inifile, for example ... [exception] title=ERROR: exceptions extract=C000 .* EXCEPTION regex=^.*? (..:..:..) .*? \((.*?)\) .* match=$1 $2 ... whic

Re: Pattern matching problem

2005-11-04 Thread Reinhard Pagitsch
Hello, Use the module File::Basename. regards, Reinhard Maxmelbin Neson (RBIN/EDM3) wrote: Pattern matching problem Hello , Please find the explanation of  my problem below This is a part of a script which should execute in both Windows and Unix .. Based on the

Re: Pattern matching problem

2005-11-04 Thread $Bill Luebkert
Maxmelbin Neson (RBIN/EDM3) wrote: > > Hello , > > Please find the explanation of my problem below > > This is a part of a script which should execute in both Windows and Unix .. > > Based on the OS the following variables are set > > If Windows $slash = "\\" and If Unix $slash = "/" > > Pa

Pattern matching problem

2005-11-03 Thread Maxmelbin Neson (RBIN/EDM3)
Title: Pattern matching problem Hello , Please find the explanation of  my problem below This is a part of a script which should execute in both Windows and Unix .. Based on the OS the following variables are set If Windows $slash = "\\" and If Unix $slash = "/"

RE: pattern matching problem

2004-07-30 Thread Joseph Discenza
Craig Cardimon wrote, on Friday, July 30, 2004 11:36 AM : To: [EMAIL PROTECTED]; : [EMAIL PROTECTED] : Subject: pattern matching problem : : : I am searching text files for the keyword Exhibit or Form followed by a : number, a decimal, and any number of letter or numbers within

pattern matching problem

2004-07-30 Thread Craig Cardimon
I am searching text files for the keyword Exhibit or Form followed by a number, a decimal, and any number of letter or numbers within parentheses or not. For example: Exhibit 12 Exhibit 12.1 Exhibit 12(a) Exhibit 12.1(a) Exhibit 12.1(2) Exhibit 12.1(a)(b) Exhibit 12.1(1)(2) Exhibit 12 (a) Exhibi

RE: Pattern matching

2002-11-15 Thread Ricci, Mark
-Original Message- From: Nick Djurovich [mailto:nick_djurovich@;aimtechnology.com] Sent: Thursday, November 14, 2002 5:17 PM To: Ricci, Mark; [EMAIL PROTECTED] Subject: RE: Pattern matching Hi Mark, Looking at the important part of the string ; /search q=court reporting [...] You

Re: Tricky pattern matching

2002-09-27 Thread Carl Jolley
On Wed, 25 Sep 2002, Erich C. Beyrent wrote: > Hey everyone, > > I am trying to do some really tricky pattern matching and replacement (well, > tricky for me...), and it looks like this: > > find this string in a file: #colwidth[@pageindex] > replace with this string: #gri

Re: Pattern Matching Help

2002-04-16 Thread Thomas R Wyant_III
Balam, You say your code is not working, but you don't say what's wrong. You could try Date::Manip. It may be overkill, of course, and you don't get a Perl date out of Parse_Date; you still need to run it through Unix_Date with the %s format qualifier. And I always seem to have to hold my tongu

Re: regex: avoiding greedy pattern matching in perl

2002-02-28 Thread Carl Jolley
On Wed, 27 Feb 2002 [EMAIL PROTECTED] wrote: > Why should greedy pattern matching be avoided. > > my e.g: here > > $_ = "bambam"; > > #option1. > print if /.*?m/ ; > print "\n"; > > #option2. > p

Re: regex: avoiding greedy pattern matching in perl

2002-02-28 Thread Carl Jolley
On Wed, 27 Feb 2002 [EMAIL PROTECTED] wrote: > Why should greedy pattern matching be avoided. > > my e.g: here > > $_ = "bambam"; > > #option1. > print if /.*?m/ ; > print "\n"; > > #option2. > p

RE: Repeated pattern matching

2001-02-28 Thread Greg Wardawy
curiosity, what application outputs this type of datafile? Peter Guzis Web Administrator, Sr. ENCAD, Inc. email: [EMAIL PROTECTED] www.encad.com -Original Message- From: Greg Wardawy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 27, 2001 10:07 AM To: [EMAIL PROTECTED]

RE: Repeated pattern matching

2001-02-27 Thread Peter Guzis
email: [EMAIL PROTECTED] www.encad.com -Original Message- From: Greg Wardawy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 27, 2001 10:07 AM To: [EMAIL PROTECTED] Subject: Repeated pattern matching Hello all, To extract data from the following text: -snip- The SDQ line can have up to 10

Re: Repeated pattern matching

2001-02-27 Thread Dirk Bremer
ot; if $sdq15 > 0; print "$sdq17,$upc,$price,$sdq18\n" if $sdq17 > 0; print "$sdq19,$upc,$price,$sdq20\n" if $sdq19 > 0; print "$sdq21,$upc,$price,$sdq22\n" if $sdq21 > 0; } The SDQ line can have up to 10 pairs store/quantity ($sdq+odd num