Re: regexp_match() returning text - Mailing list pgsql-hackers

From Andrew Gierth
Subject Re: regexp_match() returning text
Date
Msg-id 871t4j5tg4.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to regexp_match() returning text  (Emre Hasegeli <emre@hasegeli.com>)
Responses Re: regexp_match() returning text  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
List pgsql-hackers
>>>>> "Emre" == Emre Hasegeli <emre@hasegeli.com> writes:
Emre> Attached patch adds regexp_match() function which is a simpleEmre> variant of regexp_matches() that doesn't
returna 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)



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: regexp_match() returning text
Next
From: Alvaro Herrera
Date:
Subject: Re: [sqlsmith] PANIC: failed to add BRIN tuple