I am trying to find a proper regex to replace anything in a string but a group preceded by a certain pattern.
Suppose I have records like these:
Lorem ipsum dolor sit amet, consetetur sadipscing elitr. Lorem ipsum duo dolores, tempor et ea rebum.
L. i. sed diam; duo dolores. Lorem ipsum tempor et ea. Duo dolores
L.i. nonumy eirmod tempor et ea rebum. L. i. consetetur sadipscing.
I want to replace anything in the strings but what is preceded by a variant of lorem ipsum. I wish to have the following outcome:
dolor sit amet; duo dolores
sed diam; tempor et ea
nonumy eirmod tempor et ea rebum; consetetur sadipscing
I tried the following code to capture the group but am not able to capture the second occurrence of the group.
'.*((Lorem ipsum)|(L\. *i\.)) ([0-9A-Za-z]+)+.*','\4; '
I suspect it has to with the second .*
among other reasons.
I'm trying to do this in Oracle 11g but am not opposed to doing this with Python.