How to ignore naming index in modifiers? This is what i want to do (out rolled example):                                     

#mod_idx = '' or '.001' or '.002' or '.003'

mod_id    = global_prefs.mod_string                                         
mod_id_01 = global_prefs.mod_string + '.001'                                        
mod_id_02 = global_prefs.mod_string + '.002'                                        
mod_id_03 = global_prefs.mod_string + '.003'                                        
mod_id_04 = global_prefs.mod_string + '.004'                                        
mod_id_05 = global_prefs.mod_string + '.005'                                        
mod_id_06 = global_prefs.mod_string + '.006'                                        
mod_id_07 = global_prefs.mod_string + '.007'                                                                            

custom_id    = bpy.context.object.modifiers.get(mod_id)                                    
custom_id_02 = bpy.context.object.modifiers.get(mod_id_02)                                    
custom_id_03 = bpy.context.object.modifiers.get(mod_id_03)                                    
custom_id_04 = bpy.context.object.modifiers.get(mod_id_04)                                    
custom_id_05 = bpy.context.object.modifiers.get(mod_id_05)                                    
custom_id_06 = bpy.context.object.modifiers.get(mod_id_06)                                    
custom_id_07 = bpy.context.object.modifiers.get(mod_id_07)                                    

if custom_id or custom_id_01 or custom_id_02 or custom_id_03 or custom_id_04 or custom_id_05 or custom_id_06 or custom_id_07 :                                             
                        name = mod_id or mod_id_01 or mod_id_02 or mod_id_03 or mod_id_04 or mod_id_05 or mod_id_06 or mod_id_07  


My goal is to adjust all existing modifier with the same prefix.

To adjust them like a group and ignore all other existing ones!

Any hints how to do that in a meaningful short way?

        selected = bpy.context.selected_objects 
        for obj in selected:
            if global_prefs.mod_string != '':

                mod_id = global_prefs.mod_string                                                            
                custom_id = bpy.context.object.modifiers.get(mod_id)                                                                                
                if custom_id:                                             
                    name = mod_id

                    context = bpy.context.copy()
                    context['object'] = obj    

                    for mod in obj.modifiers: 
                        context['modifier'] = mod                                                  

                    for obj in selected: 
                        view_layer.objects.active = obj 

                        if self.mod_processing == "RENDER" or global_prefs.mod_processing == "RENDER":                                                        
                            if mod.show_render == True:                         
                                bpy.context.object.modifiers[name].show_render = False
                            else:
                                bpy.context.object.modifiers[name].show_render = True   


This works so far for a single modifier!
Link to the complete blender addon: modifier by type

Thaughts:

                i = 0
                pref = global_prefs.mod_string
                while obj.modifiers.get(pref):
                    name_id = pref + '.' + '001'    
                    i += 1      


This is not working! Blender hangs up!

Next:

                i = 0
                idx = '.00'                                        
                pref = global_prefs.mod_string
                name = "%s%s%d" % (pref, idx, i)
                while obj.modifiers.get(pref):  
                    i += 1                  
                    name = "%s%s%d" % (pref, idx, i)


This does not stop at the last number....
There are (at least) two ways to approach this, either you can differentiate the modifiers through their name or their type. 

Filter by Prefix

If you want to filter them by a prefix you could use the following approach to retrieve references to the modifiers. 

First, get the modifier collection of the object. All (key, value) pairs can be accessed through the .items() function. The keys are the names of the modifiers, therefore these have to be checked for a prefix match. Python has the .startswith() function to check if a string starts with a given prefix. If a match is found for a key, the corresponding value is one of the modifiers you're searching for. All of this can be combined to a list comprehension as shown below.

import bpy


prefix = "Subdiv"
modifier_collection = bpy.context.object.modifiers 
modifier_matches = [modifier for key, modifier in modifier_collection.items() if key.startswith(prefix)]

print(modifier_matches)




Filter by Type

Sometimes you may not know the name of the modifiers, since these are user editable, but you may know their type. Searching for modifiers by their type can be accomplished by getting all modifiers of the object through .values() and then checking if they are of a certain type, e.g. SUBSURF in the example below.

import bpy


modifiers = bpy.context.object.modifiers.values()
modifier_matches = [modifier for modifier in modifiers if modifier.type == "SUBSURF"]

print(modifier_matches)




The example below shows how to iterate through all modifiers of an object, check if its name starts with a given prefix and if it does, disable it for rendering by setting show_render to False.

import bpy


for key, modifier in bpy.context.object.modifiers.items():
    if key.startswith("Subdiv"):
        modifier.show_render = False