MrCBofBCinTX
Technical User
I'm using a dbi script on a database.
Someone entered some entries with extra info that I want to remove.
Found section on PostgreSQL's regex functions
I found that the following SQL works great, one by one on the entries.
With record abcdef,
Everything works fine for removing a complete string anywhere in record. cd->ok abc->ok def->ok, etc.
However, if I try to use ae as match, the entire string is removed. Same if I use ce as match.
I've reread the page a couple of times for this in PostgreSQL manual, but I don't understand what I need to do different.
Someone entered some entries with extra info that I want to remove.
Found section on PostgreSQL's regex functions
I found that the following SQL works great, one by one on the entries.
Code:
SQL:
update products set product_description = regexp_replace((select product_description from products where product_description like 'Millstead%' AND product_id=19
), 'Millstead - ', '') where product_id=19;
my perl:
my $SQL = "update $updatetable set $fi3eld = regexp_replace((select $fi3eld from $updatetable where $fi3eld like \'\%$removeExp%\' AND $id_field = $id3), \'$removeExp\', '') where $id_field = $id3;";
With record abcdef,
Everything works fine for removing a complete string anywhere in record. cd->ok abc->ok def->ok, etc.
However, if I try to use ae as match, the entire string is removed. Same if I use ce as match.
I've reread the page a couple of times for this in PostgreSQL manual, but I don't understand what I need to do different.