大网数据广告活动
网站运营与故障问答

What regex engine does mod_substitute use?

· 52CE 我爱测

Any idea what regex engine mod_substitute uses? I'd like to do a little search and replace with it, and I need to escape some characters, so I wanted to see how that particular engine handles that. (I'm guessing it's just \ to es…

问题原文

原帖链接 · leeand00 · CC BY-SA 3.0

Any idea what regex engine mod_substitute uses? I'd like to do a little search and replace with it, and I need to escape some characters, so I wanted to see how that particular engine handles that. (I'm guessing it's just \ to escape, but I wanted to know for sure.

https://httpd.apache.org/docs/2.4/mod/mod_substitute.html

已采纳解答

原帖链接 · MrWhite · CC BY-SA 3.0

As far as I know, Apache universally uses Perl Compatible Regular Expressions (PCRE). This is stated in the Apache glossary under Regular Expressions. mod_rewrite certainly uses PCRE (as stated in the mod_rewrite docs) and I would assume that mod_substitute does the same.

The backslash (\) escape is used in every regex version I've encountered.

Note that the Substitute directive uses delimiters to separate the different arguments (whereas mod_rewrite uses spaces). The default delimiter is the slash (/), but this can be changed to any other character if your string/regex contains the delimiter. Changing the delimiter is often preferable to escaping these characters in the string/regex.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-04-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。