Following code does naive matching. Give it a go.
from Blender import Scene
scn = Scene.GetCurrent()
for ob in scn.objects:
if ob.name.find('_hi') >= 0:
print 'got _hi'
if ob.name.find('_me') >= 0:
print 'got _me'
The problem with above solution is that it matches cases like “evil_object_me_hi” in both “_me” and “_hi” case. There are multiple ways to overcome this issue though. One way would be to split the string based on _ and then check if the last portion has matching element:
test_str = "foo_me_hi"
split_str = test_str.split("_")
last_part = split_str[-1]
last_part.find("hi") # should print zero
The problem with above code is that it matches also “foobar_hihi” which is not desired. Probably the easiest way to handle all the special cases is to use a suitable regex operation (http://www.python.org/doc/2.5.2/lib/module-re.html) but if you are sure you are not going to run into those nasty cases, either of the above solutions might do the trick at least for some time.