implement $regex with $options