Re: reverse strpos?

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: reverse strpos?
Date: 2007-11-12 20:25:25
Message-ID: 20071112202524.GA26692@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Nov 12, 2007 at 10:54:53AM -0500, Gauthier, Dave wrote:
> Is there a function that'll return the position of the last occurance of
> a char in a string?
> For Example, in the string 'abc/def/ghi' I want the position of the 2nd
> '/'.

# select length(substring('abc/def/ghi' from '^(.*/)'));
length
--------
8
(1 row)

depesz

--
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA. here's my CV!" :)
http://www.depesz.com/ - blog dla ciebie (i moje CV)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Dunstan 2007-11-12 20:29:34 Re: [HACKERS] plperl and regexps with accented characters - incompatible?
Previous Message Bruno Almeida do Lago 2007-11-12 20:14:24 WAL segments size