This package contains regexp functions beyond those currently provided in core PostgreSQL, utilizing the regexp engine built into core. This is still a work-in-progress. The most recent version of this code can be found at http://www.jdrake.com/postgresql/regexp/regexp_ext.tar.gz and the prerequisite patch to PostgreSQL core, which has been submitted for review, can be found at http://www.jdrake.com/postgresql/regexp/regexp-export.patch The .tar.gz file expects to be untarred in contrib/. I have made some regression tests that can be run using 'make installcheck' as normal for contrib. I think they exercise the corner cases in the code, but I may very well have missed some. It requires the above mentioned patch to core to compile, as it takes advantage of new exported functions from src/backend/utils/adt/regexp.c. Let me know if you see any bugs or issues with this code, and I am open to suggestions for further regression tests ;) Functions implemented in this module: * regexp_split(str text, pattern text) RETURNS SETOF text regexp_split(str text, pattern text, flags text) RETURNS SETOF text returns each section of the string delimited by the pattern. * regexp_matches(str text, pattern text) RETURNS text[] returns all capture groups when matching pattern against string in an array * regexp_matches(str text, pattern text, flags text) RETURNS SETOF (prematch text, fullmatch text, matches text[], postmatch text) returns all capture groups when matching pattern against string in an array. also returns the entire match in fullmatch. if the 'g' option is given, returns all matches in the string. if the 'r' option is given, also return the text before and after the match in prematch and postmatch respectively. See the regression tests for more details about usage and return values. Recent changes: * I have put the pattern after the string in all of the functions, as discussed on the pgsql-hackers mailing list. * regexp flags (a la regexp_replace). * make regexp_matches return setof whatever, if given a 'g' flag return all matches in string. Things that I still want to look into: * maybe a join function that works as an aggregate SELECT join(',', col) FROM tbl currently can be written as SELECT array_to_string(ARRAY(SELECT col FROM tbl), ',')