While the sexeger solution which I popularized a few years ago is a good solution for this, it's probably overkill. Either do as shown above:
/^[^?]*whatever/, or use a technique that is extensible for when the "?" thing is more than just one character in length:
/^(?!.*XXX.*$pattern).*$pattern/. That will match $pattern that is not preceded by XXX.