Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: Perl regex to POSIX

by Sifmole (Chaplain)
on Feb 06, 2007 at 14:07 UTC ( #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 (Chancellor) 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://598544]
and monks are getting baked in the sun...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2018-04-21 19:58 GMT
Find Nodes?
    Voting Booth?