On Tuesday, February 25, 2003, at 03:20 AM, Peter N Lewis wrote:
Chckout:

perldoc perlre

for lost and lots of cool regexp stuff like (?i:regexp) to turn off case sensitivity in part of a search and (?:) to bracket without creating a $n entry and such. And then check out the zero length assertions for some even cooler stuff.


In this case, also check out the qr// operator, which will let you pre-compile the regex and avoid using '(?i)' :


my $str  = qr/(.{11})(.{10})/i;
my $line  = "test string etc  etc test string";
if ($line =~ /$str/ ) {
  print "id = $1\n";
  print "pw = $2\n";
}


-Ken




Reply via email to