Home >Backend Development >PHP Tutorial >求正则表达式一条

求正则表达式一条

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 14:19:371108browse

匹配 非‘H’或者‘C1’开的字符串


回复讨论(解决方案)

[^H|C1]

[^H|C1]
不对哦

[^H|C1]

这个表示的是: 一个非"H"、"|"、"C"、"1"字符


[^H|C1]

这个表示的是: 一个非"H"、"|"、"C"、"1"字符
这个呢?
[^H]|[^C1]

也不对

$s = 'Abc Hsd C23 C1rt';preg_match_all('/\b(?!H|C1)\w+/', $s, $r);print_r($r);
Array
(
    [0] => Array
        (
            [0] => Abc
            [1] => C23
        )

)

$s = 'Abc Hsd C23 C1rt';preg_match_all('/\b(?!H|C1)\w+/', $s, $r);print_r($r);
Array
(
    [0] => Array
        (
            [0] => Abc
            [1] => C23
        )

)

版主拿分真利索
感谢

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:json_encode和json_decode 之间转换Next article:php解析json