8000 Documented true regex · symfony/symfony-docs@050f7ce · GitHub
[go: up one dir, main page]

Skip to content

Commit 050f7ce

Browse files
committed
Documented true regex
1 parent dc25c65 commit 050f7ce

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

components/console/helpers/questionhelper.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,24 @@ The second argument to
4141
is the default value to return if the user doesn't enter any input. Any other
4242
input will ask the same question again.
4343

44+
.. tip::
45+
46+
You can customize the regex used to check if the answer means "yes" in the
47+
third argument of the constructor. For instance, to allow anything that
48+
starts with either ``y`` or ``j``, you would set it to::
49+
50+
$question = new ConfirmationQuestion(
51+
'Continue with this action?',
52+
false,
53+
'/^(y|j)/i'
54+
);
55+
56+
The regex defaults to ``/^y/i``.
57+
58+
.. versionadded:: 2.7
59+
The regex argument was introduced in Symfony 2.7, before only answers
60+
starting with ``y`` were considered as yes.
61+
4462
Asking the User for Information
4563
-------------------------------
4664

0 commit comments

Comments
 (0)
0