I've looked through the many variations of this question have been posted before, but I still need help putting together a solution. I appreciate any help.
The alternative to a non-fixed width regex look behind seems to be creating a capture group. Can someone please help with the syntax to solve the following?
Suppose there are different sentences with the words "account", "credit" and "debit" in them. I'd like to match the ones that talk about an account being debited. So I want to eliminate matching a string that talks of it being credited. How can I match the word "account" when it is not preceded by "credit" but is followed/preceded by "debit"?
Here is my attempt at excluding the string "credit" while matching "account".
(?<!(\bcredit))(.account)
"credit your account" - fails to eliminate "credit"
"considering crediting your account promptly" - fails to eliminate "credit"
"credit account"- eliminates "credit" but only thanks to the "." in the regex.
I'd like to make the . into .{0,20} but that will not make if behave as intended.
Appreciate any help or feedback
re.sub, right? Check this approach. - Wiktor Stribiżew