def convert_search(search):
 if (not search):
  search = ''
 else:
  search = search.replace('*', '%').replace(' ', '%')
 if (search and search.startswith('^')):
  search = search.replace('^', '')
  search += '%'
 elif (search and search.endswith('$')):
  search = search.replace('$', '')
  search = ('%' + search)
 else:
  search = (('%' + search) + '%')
 return search

def convert_search ( search ) : if ( not search ) : search = '' else : search = search . replace ( '*' , '%' ) . replace ( ' ' , '%' ) if ( search and search . startswith ( '^' ) ) : search = search . replace ( '^' , '' ) search += '%' elif ( search and search . endswith ( '$' ) ) : search = search . replace ( '$' , '' ) search = ( '%' + search ) else : search = ( ( '%' + search ) + '%' ) return search
convert classic wildcard to sql wildcard .