开发者

string patterns to PCRE conversion code

I would like to know, is there a conversion library for converting string patterns to PCRE regular Expression patterns.

Sample Patterns:

application/ms-tnef ARKADMIN_GET_ 34 ^MAIL FROM|3a| ?

2|

Thank开发者_JAVA技巧s in advance.


An online solution to find a Regex from string patterns is hosted on this research project. You have only to provide some examples that covers the set of patterns you want to recognize. It's really important that this set is meaningfull.


The online tool is based on this paper.


PCRE/Regex is such a complicated morass of black magic and voodoo, that I think you'll be hard pressed to find an automated converter for it. I've tried before.

This blog post covers some of the reasons why.

That said, there is a website/tool called txt2re that might help you in getting the job done. Or you can build some matching RegEx yourself using RegExr, an online, flash-based RegEx design and testing interface.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜