as it is DNS we are talking about how about you only store the domain in the datagroup and replace the "contains" operator with "ends_with" in your iRule. I think this will achieve what you want, right? So in the datagroup you only store the core domain you are after e.g. ".google.com" - this will match "; "play.google.com", "docs.google.com" etc because they all end with ".google.com"!
Your current solution with "contains" will also kind of work.... however "contains" means found anywhere within the string, so it will match "; while "ends_with" is what you probably want with DNS