Vick Khera <vivek@khera.org> writes:
> speaking of regular expressions... the other day I was trying to find
> where the 'flags' option to regexp_replace() is described, but I
> cannot find it in the 9.0 manual in any obvious place. it is not
> described in the string functions section, nor in the regexp section.
It's described in the same paragraph that describes regexp_replace, in
http://www.postgresql.org/docs/9.0/static/functions-matching.html
The regexp_replace function provides substitution of new text for
substrings that match POSIX regular expression patterns. It has the
syntax regexp_replace(source, pattern, replacement [, flags ]). The
source string is returned unchanged if there is no match to the
pattern. If there is a match, the source string is returned with the
replacement string substituted for the matching substring. The
replacement string can contain \n, where n is 1 through 9, to
indicate that the source substring matching the n'th parenthesized
subexpression of the pattern should be inserted, and it can contain
\& to indicate that the substring matching the entire pattern should
be inserted. Write \\ if you need to put a literal backslash in the
replacement text. (As always, remember to double backslashes written
in literal constant strings, assuming escape string syntax is used.)
The flags parameter is an optional text string containing zero or
more single-letter flags that change the function's behavior. Flag i
specifies case-insensitive matching, while flag g specifies
replacement of each matching substring rather than only the first
one. Other supported flags are described in Table 9-19.
regards, tom lane