Regex Syntax changes between POSIX and PCRE

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 00:45:35

问题


We are currently in the process of upgrading our Varnish Cache servers. As part of the process, we upgraded only one of them to see how it behaves compared to the older versions.

Some of the major changes made in this new version is changing the regex engine from POSIX to PCRE. That means that some of our purges (regex purges) have stopped working on the newer server.

I was wondering if anyone can list/point me to a list of actual syntax differences between POSIX and PCRE. Or maybe a function that converts a POSIX regex to PCRE regex.

This is so that I can convert only the purges going to the newer server - without affecting the current regex syntax that is implemented in the system for the other servers.


回答1:


See Flavor Comparison at Regular-Expressions.info.

EDIT: The page above has been updated. It now brings you to a Table of Contents page. On the sub-pages linked from there tables of features are shown, and you can select two different "flavors" of regular expression syntax to compare for the feature set shown on each sub-page.




回答2:


"Regular Expressions as used in R"

I didn't find a comparison chart but I did find Regular Expressions as used in R which has a lot of information near the top part of the document related to POSIX and the bottom half details pcre and also gives links to the standards.



来源:https://stackoverflow.com/questions/4733416/regex-syntax-changes-between-posix-and-pcre

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!