Substitute_string use another field as "from"

Hi!
I have the following use case. I need to replace all substrings from one field to another field. Example:

Input: {"A":"Bar Foo", "B":"foo"}
Output: {"A":"bar", "B":"foo"}

I need to: low case both, then remove from A any matching substring from B, i.e. replace by “”.
Is there a way to do this? The docs only indicate fixed strings/regexp.

Thanks!