| This article describes the PHP regular does not contain a string of the wording, the regular expression does not contain the specified string example, the need for a friend reference. In PHP programming, the common function of matching strings is strstr ($STR, "abc"); Regular match Preg_match ("/(ABC)?/is", $STR);But to match a string that does not contain a string, it is troublesome to use the regular!strstr ($STR, "abc"); can solve the problem. Naming with a regular can be like this: "/^ (?! ABC).) *$/is "Example: The result is: false, containing abc! $str = "2b3c4d5c";Note: [^ (ABC)] This syntax checks to see if the characters in $str are not in a B C, Preg_match ("/[^ (ABC)]/s", $str, $arr);Where character 2 is not in a B C, so the $arr return value is 2; Also matches, contains the string "ABC", and does not contain the string "XYZ" "/(ABC) [^ (?! XYZ).) *$]/S " |