in reply to Re^3: XML data extraction
in thread XML data extraction

Am able to get the correct date pattern .Thanks.
For regex there will be mostly two sets of parens in single string and always want to pick the values from last set of parens i.e :100
my $name = "greenfield (Glossary) (100)"; my $appID; foreach ( $name =~ /\((.*?)\)/ ) { $appID = $1; } print $appID;

above code gives me output : Glossary

Replies are listed 'Best First'.
Re^5: XML data extraction
by hippo (Archbishop) on Oct 12, 2017 at 10:34 UTC
    #!/usr/bin/env perl use strict; use warnings; use Test::More tests => 1; my $name = "greenfield (Glossary) (100)"; my $want = '100'; $name =~ /([^(]+)\)$/; is ($1, $want, "Matched");

    If you want what's at the end, anchor it to the end.

Re^5: XML data extraction
by haukex (Archbishop) on Oct 12, 2017 at 10:35 UTC