I tried this and it seemed to work:

my $InputLine = '(! SUBSTR(DB.USER1,2,5)="99999") .AND.
(LEFT(DB.USER1,1)<"1") .AND. (ALLTRIM(DB.OUNCEWT)>"2")';
my $InputLine1 = '(! SUjSTR(DB.USER1,2,5)="99999") .AND.
(LEFT(DB.USER1,1)<"1") .AND. (ALLTRIM(DB.OUNCEWT)>"2")';
my $Str = '(! SUBSTR(DB.USER1,2,5)="99999") .AND. (LEFT(DB.USER1,1)<"1")
.AND. (ALLTRIM(DB.OUNCEWT)>"2")';

if ( $InputLine =~ /\Q$Str\E/io ) {
   print "Found the string in InputLine!!\n";
 }else {
   printf "No hit: InputLine:\n%-s\nSearch:\n%-s\n", $InputLine, $Str;
 }

if ( $InputLine1 =~ /\Q$Str\E/io ) {
   print "Found the string in InputLine1!!\n";
 }else {
   printf "No hit: InputLine1:\n%-s\nSearch:\n%-s\n", $InputLine1, $Str;
 }

running on win2000 and AS623.

Wags ;)

-----Original Message-----
From: Dirk Bremer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 31, 2001 15:03
To: perl-win32-users
Subject: Regex Help


I have a complicated string:

(! SUBSTR(DB.USER1,2,5)="99999") .AND. (LEFT(DB.USER1,1)<"1") .AND.
(ALLTRIM(DB.OUNCEWT)>"2")

that I want to search for and them replace. I have tried this with no luck:

if ($InputLine =~ /\(\! SUBSTR\(DB\.USER1,2,5\)\=\"99999\") \.AND\.
\(LEFT\(DB\.USER1,1\)\<\"1\"\) \.AND\. \(ALLTRIM\(DB\.OUNCEWT\)\>\"2\"\)/io)

I have also tried this with no luck:

if ($InputLine =~ /\(ALLTRIM\(DB\.OUNCEWT\)/io)

In the last example, I get a regex error about unbalanced paranthesis. I
would really like to assign the whole string to a scalar:

$Str = "\(\! SUBSTR\(DB\.USER1,2,5\)\=\"99999\") \.AND\.
\(LEFT\(DB\.USER1,1\)\<\"1\"\) \.AND\. \(ALLTRIM\(DB\.OUNCEWT\)\>\"2\"\)"
if ($InputLine =~ /$Str/io)

I welcome your suggestions.

Dirk Bremer - Systems Programmer II - AMS Department - NISC
636-922-9158 ext. 652 fax 636-447-4471

<mailto:[EMAIL PROTECTED]>


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to