diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index 8ad2d861654..6bc9b62c350 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -41,6 +41,24 @@ The second argument to is the default value to return if the user doesn't enter any input. Any other input will ask the same question again. +.. tip:: + + You can customize the regex used to check if the answer means "yes" in the + third argument of the constructor. For instance, to allow anything that + starts with either ``y`` or ``j``, you would set it to:: + + $question = new ConfirmationQuestion( + 'Continue with this action?', + false, + '/^(y|j)/i' + ); + + The regex defaults to ``/^y/i``. + + .. versionadded:: 2.7 + The regex argument was introduced in Symfony 2.7. Before, only answers + starting with ``y`` were considered as "yes". + Asking the User for Information -------------------------------