in reply to RegEx Help - Look Behind
As I understand it, this means that from the point you invoke one of those evil 3, your program will cache (in your precious RAM) every text match it makes while the program is running - if you're parsing a large amount of data that's *nasty*!
There is no need in this case (and I don't recall ever finding a case that did need) to use $& - what you want is a specific part of the match (for that you could use round brackets) like this:
Here the $1 returns the portion between the first () in the match ($2 will return the second and so on...)#!/usr/bin/perl -w use strict; my $string = qq{oCMenu.makeMenu('m40','','Files','','',100,20) oCMenu. +makeMenu('m41','m40','Periodic Reports','index.cfm?openaction=file_ar +chive.view&CONTENT_ID=BF764E84-ED11-EC57-40672E520082E823','',125,20) + oCMenu.makeMenu('m53','m40','Reference Documents','index.cfm?openact +ion=file_archive.view&CONTENT_ID=BF76E870-E7CC-515F-D4D5C3D4A210BB9A' +,'',125,20)}; $string =~ /Periodic Reports','([^']+)'/; print "Want to see:\n", "index.cfm?openaction=file_archive.view&CONTENT_ID=BF764E84-ED11-EC57- +40672E520082E823", "\n$1\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: RegEx Help - Look Behind
by dcd (Scribe) on Dec 03, 2005 at 16:39 UTC |