Simple regular expression $ ss & nbsp ;=& nbsp; "/\ [\ $? [\ W \.] + \]/"; preg_match_all ($ ss, & nbsp;" [abc] ", & nbsp; $ mat); // [$ abc] & nbsp; [abc] a simple regular expression is not available for all horses.
$ Ss = "/\ [\ $? [\ W \.] + \]/";
Preg_match_all ($ ss, "[abc]", $ mat); // [$ abc] [abc] cannot be matched
------ Solution --------------------
$ss = "/\[\\$?[\w]+\]/";
preg_match_all($ss, '[abc]vv[$def]', $mat);
print_r($mat);
Array
(
[0] => Array
(
[0] => [abc]
[1] => [$ def]
)
)
------ Solution --------------------
Reference:
Reference: csdn is a mess...
$ Ss = "/\ [\\$? [\ W \.] + \]/";
Or
$ Ss = '/\ [\ $? [\ W \.] + \]/';
4th Floor
$ Ss = '/\ [\ $? [\ W \.] + \]/'why can't [abc] it be matched?
Why cannot It be matched?
Yes. Have you tried ??
$ No Escape refers to a variable.
In "", \ $ also refers to the variable... Therefore, the escape character "$" is required.