Regex patterns were not being escaped properly so package names containing characters that could be interpreted as regex symbols were causing failures. Fixes: #19714