Skip to content

Commit

Permalink
Documented true regex
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Jan 18, 2015
1 parent dc25c65 commit 050f7ce
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions components/console/helpers/questionhelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------------------------

Expand Down

0 comments on commit 050f7ce

Please sign in to comment.