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

求正则表达式一条

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 14:19:37
Original
1080 people have browsed it

匹配 非‘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);
Copy after login
Copy after login
Array
(
[0] => Array
(
[0] => Abc
[1] => C23
)

)

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

)

版主拿分真利索
感谢

Related labels:
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template