Re: Regex search question

2003-11-06 Thread John W. Krahn
Paul Harwood wrote:
 
 I know that
 
 if ( /VALUE={1}(\d+)/ ) {
 
 looks for the first occurrence of value. How do I find the last occurrence?

Probably the most efficient way:

my $rev = reverse $_;
if ( $rev =~ /(\d+)=EULAV/ ) {


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Regex search question

2003-10-29 Thread Paul Harwood
I know that
 
if ( /VALUE={1}(\d+)/ ) {
 
looks for the first occurrence of value. How do I find the last occurrence?
 
--Paul


Re: Regex search question

2003-10-29 Thread Rob Dixon
Paul Harwood wrote:

 I know that

   if ( /VALUE={1}(\d+)/ ) {

 looks for the first occurrence of value. How do I
 find the last occurrence?

Firstly you don't need the {1} in there. All it's
doing is insisting that there is only one equals
character, which an unquantified /=/ will do anyway.

To find the last occurrence, just chew up as many
characters as possible from the object string first:

  /.*VALUE=(\d+)/

HTH,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]