Im trying to replace a matched string only - and nothing else within the column, with another value.
For example:
My name is GaryBrooks.
The Partnertime series was good.
Match:
GaryBrooks
Partner time
Expected output:
My name is [TM="GaryBrooks"].
The [TM="Partner time"] series was good.
So far, ive done the following;
| trademarkname | tm_value | DESCRIPTION_TEXT |Compare|
------------------------------------------------------------
| GaryBrooks | [TM="GaryBrooks"]| My name is GaryBrooks. |yes
| Partner time| [TM="Partner time"] |The Partnertime series was good.|yes
file['Compare'] = file.apply(lambda x: 'Yes' if x['trademarkname'] in x['DESCRIPTION_TEXT'] else 'No',axis=1)
I was successful until the match was found but not yet in replacing it. Im not sure if this is a regexp replace function or a for loop
Something like this is what I wanna do or think:
WHEN "Compare" IS 'Yes' THEN regexp_replace("DESCRIPTION_TEXT", "trademarkname"
(This is what has to be matched, "tm_value" (*this is what the string should be replaced with)