Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #3.
This change adds the regular expression functions that find each match in a string. The views of
information_schemaand the queries of client tools use some of them, such asregexp_replace. With this change, rupg has all the regular expression functions of PostgreSQL 19.What changes
Regex::find_charsfinds a match from a given character. The constraints, such as^and a lookbehind, still see the characters before that place, as inpg_regexec.setup_matchesportssetup_regexp_matches. It finds the first match or each match, and the search after an empty match starts one character later.regexp_replacehas its five forms. The replacement takes\1to\9,\&and\\, asappendStringInfoRegexpSubstrdoes. Options that start with a digit give the error of PostgreSQL with its hint.regexp_count,regexp_instrandregexp_substrhave each of their forms, with the checks ofstart,n,endoptionandsubexpr.regexp_matchesandregexp_split_to_tableare set-returning functions inFROM.regexp_split_to_arraygives the same parts as an array. An empty match at the end of the string or just after a match does not split the string.Test
regex_matchesruns a script and compares the result with the output of PostgreSQL 19 for the same script in a new database. It covers each function and form, empty matches, a start after the first character, characters of more than one byte,LATERAL, each error and a view.