I've written a variant of regexp_matches called regexp_matches_positions which instead of returning matching substrings will return matching positions. I found use of this when processing OCR scanned text and wanted to prioritize matches based on their position.
The patch is for discussion. I'd also appriciate general suggestions as this is my first experience with the postgresql code base.
The patch is against the master branch and includes a simple regression test.