Since a rowname may contain characters reserved by regular expressions I've found it easier to deal with the rowname finding by just checking for matching strings at the beginning of the name while at the same time excluding names that have the same stem, i.e. DM and DM_COMP will cause an issue since DM will match both rows.
prFindRownameMatches(rnames, vn, vars)
integer A vector containing the position of the matches
TODO: remove this function in favor of the more powerful prMapVariable2Name
A vector with the rownames that are looked for
The variable name that is of interest
A vector with all the names and the potentially competing names