10000 feature #4879 Documented true regex (WouterJ) · symfony/symfony-docs@a57db5b · GitHub
[go: up one dir, main page]

Skip to content

Commit a57db5b

Browse files 8000
committed
feature #4879 Documented true regex (WouterJ)
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
2 parents 7c07a44 + 6e6bae8 commit a57db5b

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