Thread: pgAdmin's internal find-replace/search-replace dialog using regex groups in the replace-box?
pgAdmin's internal find-replace/search-replace dialog using regex groups in the replace-box?
Hey, all.
I was wondering whether PgAdmin currently supports the functionality of replacing matched strings using one or more of the captured groups that come from the regex used to find the original strings/substrings. Using captured groups inside of replacements can be useful for altering syntax across a set of statements or (say) changing the order of a bunch of function-parameters if the signature has changed.
It appears that pgAdmin supports POSIX-esque regular-expressions (like PHP or Vim do), and allows regex-groups to be specified, however, other POSIX-y engines support using captured components in the replacements like \0, \1, \2, etc., where each number represents a component of the pattern, up to the ninth group.
For example, the pattern '\([^ \n]+n\)[ \n]' on the string "The pgAdmin client is pretty great." would cause \0 to be the whole match "pgAdmin " (including trailing space) whereas \1 would be "pgAdmin" (without the trailing space).
It would be great if replacements like this were supported, but after trying a few different variations on the replacement-syntax to no avail, I decided I'd just ask whether it's actually possible to get anything other than literal '\1's and '\0's back in the new string when I hit "replace". Is this currently possible in the latest version?
Thanks,
- Patrick
Application Developer
Wyoming Natural Diversity Database
UW Berry Biodiversity Conservation Center
Department 3381, 1000 E. University Av.
Laramie, WY 82071
P: 307-766-3018