Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: regular expressions in Perl and Oracle/SQL

Re: regular expressions in Perl and Oracle/SQL

From: Ed Prochak <prochak_at_my-deja.com>
Date: Thu, 19 Aug 1999 16:52:27 GMT
Message-ID: <7phco4$4ol$1@nnrp1.deja.com>


In article <37BC1D7B.3F854DDB_at_infineon.com>,   Philippe Emeriau <Philippe.Emeriau_at_infineon.com> wrote:
> Hi *,
>
> I would like to know if there is somewhere in Perl a function that
> computes a regular expression and gives the result stored inside a
> string ?
> Example : the regexp is "foo[1-6]", and I would like to store the
result
> "foo1 foo2 foo3 foo4 foo5 foo6" in a variable.
> Be careful , the regexp can be very more powerful, with |, &&, [, (,
...
> supported operators !!!
>
> I know that Perl computes the regular expression internally, but I
would
> like to keep the result for me, and use it to translate it in an SQL
> query (that's why I need the long string, that can be cut in different
> substrings to create the SQL query)
>
> Thanks in advance for any help or information
> Cheers
>
> Philippe
>
> Philippe EMERIAU
> Senior Software Engineer
> Infineon Technologies Sophia Antipolis
> Gaïa, 2600 Route des Crêtes
> F-06560 Sophia Antipolis – FRANCE
> WARNING : NEW EMAIL !!!
> Email: Philippe.Emeriau_at_infineon.com
> Tel: (+33)(0)4 92 38 37 21
> Fax: (+33)(0)4 92 38 37 99
>
>

Sorry, but PERL does NOT generate all possibilities from the expression. If you want to use something as powerful as PERL's regular expressions, why not use PERL? You can query the database for the key fields, parse them in PERL, create a new query (or set of queries) from the parsed key list and get your results. Alternately you could use Pro*C in a similar manner.

The approach you suggest doesn't work. (as already pointed out by another poster). What you want is code which: given a regular experssion, generates the finite state machine that recognizes that pattern. You then call the generated routine with a string and the routine returns TRUE or FALSE whether the string fits the pattern.

So you may have to rethink your problem. What are you really try to do?

--
Ed Prochak
Magic Interface, Ltd.
ORACLE services
440-498-3702

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Thu Aug 19 1999 - 11:52:27 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US