我想刪除#xyzbegin和#xyzend之間之間的所有東西都刪除PHP正則表達式匹配/兩個字
#xyzbegin
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{DOCUMENT_ROOT}/wp-content/xyz-cache/$1/index.html -f
RewriteRule ^(.*) "/wp-content/xyz-cache/$1/index.html" [L]
</IfModule>
#xyzend
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
我正則表達式是:
'/#xyzbegin(.*)#xyzend/m'
我想這太:
'/^#xyzbegin(.*)#xyzend$/m'
兩者都不起作用。請幫忙。
'(?<=#xyzbegin)(。*?)(?=#xyzend)'? – ndn
即匹配並刪除文件 –
中的所有其他內容如何?你能給我們一個例子文件嗎? – ndn