File tree 1 file changed +18
-0
lines changed
components/console/helpers
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,24 @@ The second argument to
41
41
is the default value to return if the user doesn't enter any input. Any other
42
42
input will ask the same question again.
43
43
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
+
44
62
Asking the User for Information
45
63
-------------------------------
46
64
You can’t perform that action at this time.
0 commit comments