Home >Backend Development >PHP Tutorial >How to match slash in php regular expression

How to match slash in php regular expression

WBOY
WBOYOriginal
2016-07-06 13:53:252282browse

<code>preg_match_all('/ue[0-9]{3}/', '\ue412大猫 \ue413', $res);
   p($res);</code>
<code>Array
(
    [0] => Array
        (
            [0] => ue412
            [1] => ue413
        )

)</code>

我是要匹配出ue412和ue413的。。但是把正则改成'/\ue[0-9]{3}/'或者'/ue[0-9]{3}/',他就什么都不匹配出来了

回复内容:

<code>preg_match_all('/ue[0-9]{3}/', '\ue412大猫 \ue413', $res);
   p($res);</code>
<code>Array
(
    [0] => Array
        (
            [0] => ue412
            [1] => ue413
        )

)</code>

我是要匹配出ue412和ue413的。。但是把正则改成'/\ue[0-9]{3}/'或者'/ue[0-9]{3}/',他就什么都不匹配出来了

<code>/\\\~~~~~~~~~~~/</code>

已经解决了。。原来三个斜杠就可以了

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