Skip to content

Commit

Permalink
feature #4879 Documented true regex (WouterJ)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.7 branch.

Discussion
----------

Documented true regex

| Q   | A
| --- | ---
| Doc fix? | no
| New docs? | yes (symfony/symfony#11129)
| Applies to | 2.7+
| Fixed tickets | -

Commits
-------

6e6bae8 Small grammar-ish fix
050f7ce Documented true regex
  • Loading branch information
weaverryan committed Jan 30, 2015
2 parents 7c07a44 + 6e6bae8 commit a57db5b
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 a57db5b

Please sign in to comment.