This looks a lot like StreamPredicateList::parseStrings(), maybe you can reuse that?