preg_match("/^[MYEXPRESSION]+$/i", $anything)
What can I set MYEXPRESSSION
to such that the above line always returns true? Nothing outside the MYEXPRESSION
character class can be changed.
Doesn't seem possible
preg_match("/^[.]+$/i", $anything)
would need at least one character to match. Changing MYEXPRESSION otherwise like to .]*[.
won't help as long as the + sign is there there needs to be at least one character to match.
preg_match("/^[_]?|\]+$/i", $anything)
So EXPRESSION = '_]?|\'
, you can replace the _
portion with anything really...
This is not possible. The +
quantifier requires at least one character so it won't be able to match the empty string.
You've a +
qualifier so that means at least one or more. In other words, it can never be set to not match anything always .
However, you can set MYEXPRESSSION
to ^\r\n
so that it'll match anything but a newline .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.