in reply to extracting data from string

You mean you want to do s/[()]|defined//g; ?
Edit: or a more refined s/defined[(]|[)]$//g;