Here's one way:
namespace qi = boost::spirit::qi;
std::string s = "AB1234xyz5678C9";
int x = 0;
auto f = [&x](char c){ if (::isdigit(c)) x = x * 10 + (c - '0'); };
qi::parse(s.begin(), s.end(), +(qi::char_[f]));
[EDIT]
Or, without isdigit:
auto f = [&x](char c){ x = x * 10 + (c - '0'); };
qi::parse(s.begin(), s.end(), +(qi::char_("0-9")[f] | qi::char_));
[EDIT 2]
Or, without a lambda:
#include "boost\phoenix.hpp"
...
namespace phx=boost::phoenix;
qi::parse(s.begin(), s.end(),+(qi::char_("0-9")
[phx::ref(x) = phx::ref(x) * 10 + qi::_1 - '0'] | qi::char_));
[EDIT 3]
Or, with a recursive rule:
qi::rule<std::string::iterator, int(int)> skipInt =
(qi::char_("0-9")[qi::_val = qi::_r1 * 10 + (qi::_1 - '0')]
| qi::char_[qi::_val = qi::_r1])
>> -skipInt(qi::_val)[qi::_val = qi::_1];
qi::parse(s.begin(), s.end(), skipInt(0), x);