$test = "\\includegraphic[adsfasdf]{dasistmeinstring.tex}"; @myarray = ($test =~ m/(\\includegraphic.*\{\w*\.\w*\})/);