#在正则表达式php中的符号

Dmitriy_Nik

我在正则表达式中遇到'#'符号的问题。我有一个字符串(URL),它包含#符号。我如何用正则表达式检查它在这里还是不在这里?

这是字符串“ 293892-my-page-#92.html”和正则表达式

RewriteRule ^([0-9]*)-([\#a-z0-9-])*.html$ page.php [L]

使用这个我得到了“ 293892-my-page-”

谁能帮我这个?

莫申
$content = '<a href="http://exaple.com/293892-my-page-#92.html"></a>';

preg_match("|/([0-9+].+?)\.html|si", $content, $matches);

print_r($matches);

结果:

Array
(
    [0] => /293892-my-page-#92.html
    [1] => 293892-my-page-#92
)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章