in reply to Re: regex help
in thread regex help

no criteria, just missed it out by accident. all i need to do is extract variable,array names. variables like $array1 should just be $array. i guess i will need to avoid ${__PACKAGE__

Replies are listed 'Best First'.
Re^3: regex help
by JavaFan (Canon) on Apr 21, 2012 at 21:16 UTC
    Perhaps then all what you need is (untested):
    /(?(DEFINE) (?<sigil> [\$\@%&*]) (?<name_atom> (?: [_A-Za-z][_A-Za-z0-9]* | [0-9]+) ) (?<separator> (?: :: | ')) (?<name> (?: (?&separator)? (?&name_atom) (?:(?&separator) (?&name_atom))*)) (?<punct> \S)) (?&sigil) \s* (?:(?&name) | (?&punct)) /x
      Unless there is use utf8; somewhere... :-)
        I assume that's on the OPs list of variables he'll avoid. Just like he won't be using ${^POSTMATCH} or any of those special variables...