I am looping through a table and XXXXX out first names and surnames.
The below code works, but obviously things go badly wrong when an Initial is used. I could do first name and surname separately and use a length clause.
But I was wondering if there is away to ignore first names and surnames where they are less than 2 in length?
create table reg_test(id integer, note_text text)
insert into reg_test values (1,'sjdfhsdjh sdfsdf ksdfksf John dsfsfgsdfhj Smith dsfsfsdf');
update reg_test
SET note_text = regexp_replace(note_text, 'J|Smith' , 'XXXXX', 'ig')
where id = 1;