Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: regex help

by Anonymous Monk
on Apr 21, 2012 at 20:52 UTC ( [id://966413]=note: print w/replies, xml ) Need Help??


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...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://966413]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-18 11:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found