if we do search by regex, why do we need to do the loop before?