Re: back references using regex

From: Matthew Peter <survivedsushi(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: back references using regex
Date: 2005-09-08 20:52:35
Message-ID: 20050908205235.49711.qmail@web35204.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I knew I should never have said Python. I know regular
expressions, just not how postgresql handles them. The
fact of the matter is I don't want to use Python, it
was an example of the functionality I'm interested in
accomplishing with pgsql. Plus, I would like to use
other regex's once I figure out how they are used.

I only need a regular expression in the substring of a
where cluase. Not entire language support for a single
function.

It's not a complex regex as I have wrote one that does
what I want, yet not at the database level. The docs
didn't help clarify anything. I'm still not clear on
how it determines where the back reference comes from
in the previous example you gave. And why digits
wouldn't work.

I would like a basic example that accomplishes what
I'm trying to do if at all possible?

My original message/problem...

What I basically want to do is have a slice function
like Python, where I can slice out items from a \s, \.
or \n\n separated list. Where I'll just change the
delimiter for the query that it applies.

Where I could start it at a certain point and end it
at another. Like slicing out paragraph 3-6 (delimiter
\n\n) or the 2nd-6th sentence in a article (delimiter
\.). That is what I am trying to do. I know if I can
figure how to get that working I can figure out how to
deal with extending it/handling misc. characters/etc
in pgsql. I only need a working vanilla example.
Thanks for all your help.

--- Michael Fuhr <mike(at)fuhr(dot)org> wrote:

> On Thu, Sep 08, 2005 at 12:45:40PM -0700, Matthew
> Peter wrote:
> > Ya, but I'd have to recompile to get python in.
>
> Recompiling to add support for another procedural
> language is a
> one-time operation and it's easy to do, so that's
> not a good argument.
>
> > Plus, I don't want to use Python. I want to use
> and learn
> > more pgsql. Keep things clean and lean if
> possible...
>
> "Clean and lean" suggests using the right tool for
> the job. Languages
> like Perl and Python are better at string
> manipulation than PL/pgSQL,
> and one of PostgreSQL's strengths is that it allows
> you to write
> server-side functions in those languages. Exploit
> such strengths
> when it makes sense.
>
> > I just got a postgres book yesterday for
> additional
> > reading which it only had 2 pages on regex's in
> the
> > index :(
>
> Regular expressions aren't specific to PostgreSQL;
> there's ample
> material covering them elsewhere. See for example
> _Mastering
> Regular Expressions_ by Jeffrey Friedl. I'm sure a
> search engine
> would yield many free tutorials on the subject.
>
> --
> Michael Fuhr
>

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Schmidt 2005-09-08 20:55:34 Re: EMS PostgreSQL Manager vs. TheKompany DataArchitect
Previous Message Tom Lane 2005-09-08 20:36:16 Re: per user logging