Regex with lookbehind searching for substring

I need help with a Regex. I want to replace all occurrences of 5% or 7% or 183% or 99% to “ (empty string) BUT if the occurrence is 0% or 100% (it could be dozens of occurrences that I want to preserve) I dont want to do anything.

For example:

aaa 0% bbb should become aaa 0% bbb (nothing changed)

However

aaa 40% bbb should become aaa bbb

I came up with a regex using negative lookbehind but it just removes the % sign, not the number. This is the regex:

replace (? with `` (empty string)

The regex above, when applied to the string aaa 40% bbb returns aaa 40 bbb.

Read more here: Source link