By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table t(foo varchar(255));
insert into t (foo) values
('the quick brown fox'),
('jumped over the lazy dog');
select * from t;
foo |
---|
the quick brown fox |
jumped over the lazy dog |
select regexp_replace(foo, '[^a-z]+', '-') from t;
regexp_replace(foo, '[^a-z]+', '-') |
---|
the-quick-brown-fox |
jumped-over-the-lazy-dog |