字符串模式到 PCRE 转换代码

发布于 2024-09-05 09:11:26 字数 146 浏览 1 评论 0原文

我想知道是否有一个转换库用于将字符串模式转换为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倾听心声的旋律 2024-09-12 09:11:26

从字符串模式查找正则表达式的在线解决方案托管在此研究项目上。您只需提供一些涵盖您想要识别的模式集的示例。这组内容有意义非常重要。


该在线工具基于本文

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.

蔚蓝源自深海 2024-09-12 09:11:26

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文