Re: regexp_match() returning text

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: emre(at)hasegeli(dot)com
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: regexp_match() returning text
Date: 2016-05-30 18:01:39
Message-ID: 871t4j5tg4.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Emre" == Emre Hasegeli <emre(at)hasegeli(dot)com> writes:

Emre> Attached patch adds regexp_match() function which is a simple
Emre> variant of regexp_matches() that doesn't return a set.

We already have a function that takes a string and a regexp and returns
a single text result: substring().

Regexp flags other than 'g' can also be embedded in the regexp:

postgres=# select substring('foo bar' from '(?i)BA+');
substring
-----------
ba

Returning an array containing the values of all capture groups might be
more useful (substring returns the value of the first capture group if
any, otherwise the matched string).

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2016-05-30 18:49:15 Re: [sqlsmith] PANIC: failed to add BRIN tuple
Previous Message David G. Johnston 2016-05-30 17:39:18 Re: regexp_match() returning text