handling empty regex case