8000 Documented true regex by wouterj · Pull Request #4879 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Documented true regex #4879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 30, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
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