Use \K as a special case.
This is the variable length of the lookbehind positive statement:
/eat_(?:apple|pear|orange)_\Ktoday|yesterday/g
Alternatively, you can list your lookbehind statements separately:
/(?:(?<=eat_apple_)|(?<=eat_pear_)|(?<=eat_orange_))today|yesterday/g
However, I would suggest that this was a rare problem that could potentially use this function, but could not rethink the use of a combination of other more general regular expression functions.
In other words, if you are stuck with a specific problem, feel free to share it here, and I'm sure someone could come up with a different (possibly better) approach.
Miller
source share