code: def convertstr2format(col,form):
      
      if not isstrallowed(col,form):
          col=col.replace(" ","_") 
          if not isstrallowed(col,form):
              chars_disallowed=[char for char in col if not isstrallowed(char,form)]
              for char in chars_disallowed:
                  col=col.replace(char,"_")
      return col
docs: Convert input string to input regex (`form`).
      
      :param col: input string.
      :param form: eg. for hdf5: `"^[a-zA-Z_][a-zA-Z0-9_]*$"`