This question has no specific regex engine in mind.
I need to, when the word ends with a specific suffix, replace all occurrences of a specific character in the word and then additionally remove its suffix. For consistency, I will use vim-like regex-replace syntax. Here is what I have so far:
s/a(\w*)s\b/e\1/g
This finds an occurrence of an "a" character in any word ending with an "s" and replaces it with an "e", while additionally removing the "s" but does not overlap in the sense that it cannot match and replace multiple occurrences of a character in the same word.
A solution must match and replace one or more characters while also removing the suffix.
Some example behavior:
cars -> cer
creators -> creetor
bowling -> bowling
bowling balls -> bowling bell
castration -> castration
castrations -> cestretion