Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Perl regex to POSIX

by Sifmole (Chaplain)
on Feb 06, 2007 at 14:07 UTC ( [id://598544]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl regex to POSIX
in thread Perl regex to POSIX

I appreciate the input.

Unfortunately, what I said about covers the details; but I will try again.

There is an application which allows users to input regular expressions which are saved and used later for different operations. The input regular expressions are validated by passing them through the qr() method and accepted if they do not throw an error. This has to this point worked fine as the later processing was being performed in Perl code.

I have a requirement that involves moving that same processing into a database model ( Postgres ) and support the existing regular expressions which users have already saved. I thought to convert the existing expressions to POSIX format because Postgres supports that.

Thanks in advance for any help.

Replies are listed 'Best First'.
Re^3: Perl regex to POSIX
by Fletch (Bishop) on Feb 06, 2007 at 15:16 UTC

    That's actually a much better problem description because you've a) nailed down the why behind what you're attempting to do which can dispel any lingering hints of X-Y problems, and b) given a more concrete target (convert Perl regexen into POSIX regexen as understood by Postgres).

    You might look into building a convertor on top of YAPE::Regex. It would parse an existing regex and then walk it emitting a Postgres regex equivalent (or throwing an error if it encounters something like (?{}) which doesn't have an analogue).

    Update: D'oh! Forgot that Pg can embed Perl; that'd be a much better route if you can swing it than translating. Go with the suggestion below if you can; parse and convert as a last resort.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://598544]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-03-29 12:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found