in reply to regex for [ but not \[
s/\\\[.*?\]\\//g; # get rid of what you don't want first @wanted = (/\[(.*?)\]/g); # then get what you want [download]