replace regex exercise with modifications