casting matching strings into variable