in reply to Regex to strip, keep, or add—depending

your first and second regex's are identical ... what was the actual code for the second attempt?

Update: This works: $_ =~ s/^&(\w+)([()]*)/ $1 . ($2 || '()') /e; Though i'm curious to see someone post a solution that doesn't require the /e modifier...