字符串模式到 PCRE 转换代码
我想知道是否有一个转换库用于将字符串模式转换为 PCRE 正则表达式模式。
示例模式:
application/ms-tnef ARKADMIN_GET_ 34 ^MAIL FROM|3a| ?
2|
提前致谢。
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|
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从字符串模式查找正则表达式的在线解决方案托管在此研究项目上。您只需提供一些涵盖您想要识别的模式集的示例。这组内容有意义非常重要。
该在线工具基于本文。
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 是一个充满黑魔法和巫毒的复杂泥沼,我想你很难找到一个适合它的自动转换器。我以前尝试过。
这篇博文介绍了其中的一些原因。
也就是说,有一个名为 txt2re 的网站/工具可以帮助您完成工作。或者,您可以使用 RegExr(一个基于 Flash 的在线 RegEx 设计和测试界面)自行构建一些匹配的 RegEx。
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.