I have this very simple parser using Boost::Spirit:
rule zeroTo255 = (string(\"25\") >> char_(\'0\', \'5\')
I faced a similar problem once. This is the particular way the alternative operator in Spirit works. Your example should work if you use additional directive "hold".
rule zeroTo255
= hold[string("25") >> char_('0', '5')]
| hold[char_('2') >> char_('0', '4') >> digit]
| hold[char_('1') >> repeat[2](digit)]
| hold[char_('1', '9') >> digit] | digit;
For details of this behavior see this thread.