added $regex condition for queries