in reply to Re^2: regex greediness
in thread regex greediness

Sorry for the typo, meant to type this, but it's still wrong:
/(a)(?=(.*?)(?:b=(\w)))?/
This seems to work:
/(a)(.*?)(?=b=(\w)|\z)/