On Thu, Mar 6, 2025 at 11:24 AM Ron Johnson <ronljohnsonjr@xxxxxxxxx> wrote: > I already do that. This is part of a long chain of commands so I'm trying to minimize the length of commands. but given that your regexp patterns are not anchored, they are not equivalent. I think mine is "more correct". > Anyway, it would be good to know the answer for any future queries that need multiple exclusions. Sure. First, it works fine with TCSH :). I repro a (different) failure in BASH. But the below works fine for me: psql "service=acme" -Xc 'select datname from pg_database where datname !~ $$(template|postgres)$$ order by 1' i.e. use single-quotes, and an inner $$ literal. One of 3 options an AI chatbot gave me. --DD