使用正则表达式获取指定元素 - PHP
get a specified element using regex - PHP
我正在尝试使用 regex
在 .htaccess
文件中获取页面的名称,这是行:
RewriteRule ^test.html$ /public/index.php?test=
我正在尝试检索 test.html
。这是我迄今为止尝试过但效果不佳的方法:
preg_match('/\b\^[\w%+\/-]+?$\b/', $input, $matches);
有什么帮助吗?当谈到正则表达式时,我很挣扎!非常感谢。
我正在尝试使用 regex
在 .htaccess
文件中获取页面的名称,这是行:
RewriteRule ^test.html$ /public/index.php?test=
我正在尝试检索 test.html
。这是我迄今为止尝试过但效果不佳的方法:
preg_match('/\b\^[\w%+\/-]+?$\b/', $input, $matches);
有什么帮助吗?当谈到正则表达式时,我很挣扎!非常感谢。