开发者

need help creating a non matching regex pattern

开发者 https://www.devze.com 2023-02-08 17:27 出处:网络
i\'m trying to create a regex pattern that returns true if a certain word is not found. Ive tried using [^word] but that doesn\'t match up against a word just the individu开发者_运维问答al characters

i'm trying to create a regex pattern that returns true if a certain word is not found. Ive tried using [^word] but that doesn't match up against a word just the individu开发者_运维问答al characters as they appear.

I need preg_match(using php) to return true cause there are other words that I to match and return true.


if you are looking for a string within a string (no pattern needed) then use strstr() or stristr()


if (!preg_match("/word/", $string)) { // <-- true, if not match
    // code here
}
0

精彩评论

暂无评论...
验证码 换一张
取 消