From 050f7cee42458b64ab0be20472302c6105ac9379 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 18 Jan 2015 23:19:49 +0100 Subject: [PATCH 1/2] Documented true regex --- components/console/helpers/questionhelper.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index 8ad2d861654..bf30da8cf27 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 ------------------------------- From 6e6bae88eb62da17ed2e6f67979d621b54b21c01 Mon Sep 17 00:00:00 2001 From: Wouter J Date: Sun, 25 Jan 2015 10:50:50 +0100 Subject: [PATCH 2/2] Small grammar-ish fix --- components/console/helpers/questionhelper.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index bf30da8cf27..6bc9b62c350 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -56,8 +56,8 @@ input will ask the same question again. 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. + The regex argument was introduced in Symfony 2.7. Before, only answers + starting with ``y`` were considered as "yes". Asking the User for Information -------------------------------