ammasajan
ammasajan

Reputation: 1

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|

Thanks in advance.

Upvotes: 0

Views: 1606

Answers (2)

Simone-Cu
Simone-Cu

Reputation: 1129

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.

Upvotes: 1

Kumba
Kumba

Reputation: 2428

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.

Upvotes: 0

Related Questions