On Thu, Dec 28, 2023 at 6:25 AM Peter Eisentraut <pe...@eisentraut.org> wrote: > > On 27.12.23 17:53, jian he wrote: > > similar to [1], add function argument names to the following functions: > > regexp_like, regexp_match,regexp_matches,regexp_replace, > > regexp_substr,regexp_split_to_array,regexp_split_to_table,regexp_count > > Note that these functions are a quasi-standard that is shared with other > SQL implementations. It might be worth looking around if there are > already other implementations of this idea. >
turns out people do like calling functions via explicitly mentioning function argument names, example: [0] There are no provisions for the argument names. I looked around the oracle implementation in [1], and the oracle regex related function argumentation name in [2] I use the doc [3] syntax explanation and add the related function names. Current, regex.* function syntax seems fine. but only parameter `N` seems a little bit weird. If we change the function's argument name, we also need to change function syntax explanation in the doc; vise versa. QUOTE: The regexp_instr function returns the starting or ending position of the N'th match of a POSIX regular expression pattern to a string, or zero if there is no such match. It has the syntax regexp_instr(string, pattern [, start [, N [, endoption [, flags [, subexpr ]]]]]). pattern is searched for in string, normally from the beginning of the string, but if the start parameter is provided then beginning from that character index. If N is specified then the N'th match of the pattern is located, otherwise the first match is located. END OF QUOTE. maybe we can change `N` to occurrence. but `occurrence` is kind of verbose. [0] https://stackoverflow.com/questions/33387348/oracle-named-parameters-in-regular-functions [1] https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/REGEXP_SUBSTR.html#GUID-2903904D-455F-4839-A8B2-1731EF4BD099 [2] https://dbfiddle.uk/h_SBDEKi [3] https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP