Select object by part of their material name
In that case, even a simple condition should do the trick.

import bpy

obj_list = []

for o in bpy.data.objects:
    for m in o.material_slots:
        if "text" in m.name:
            obj_list.append(o)

print (obj_list)


I suggest  add the items to a set instead of a list &mdash; avoids adding multiple entries of identical objects (in case there are multiple materials per object containing text as substring in their name). 

import bpy

obj_set = set()

for o in bpy.data.objects:
    for m in o.material_slots:
        if "test" in m.name:
            obj_set.add(o)

if len(obj_set):
    bpy.ops.object.add(type='EMPTY', location=(0,0,0))
    emtpy_obj = bpy.context.object
    for o in obj_set:
        o.parent = emtpy_obj