# Select parts of Input Cell

One of my cells contains some Text and Input:

some text 3+5,


so the expression underlying this looks like

Cell[  TextData[{
"some text ",
StyleBox["3+5", "Output"]
}],   "Text"]


I now wish to select only the "3+5", using commands, as to be able to evaluate that part in place, as if one uses the command "Evaluate in Place" of the Evaluation menu (and using the notebook end to manually select 3+5).

I've tried using Cases[ ... , StyleBox[__]], but this gives an empty set. What am I missing here?

Once again, thanks for all help!

-

If I understand correctly you want to replace all output-style boxes with evaluated values. You can do this by

Module[{nb = EvaluationNotebook[], sel = Null},
SelectionMove[nb, Before, Notebook, AutoScroll -> False];
While[sel =!= {},
SelectionMove[nb, Next, Cell, AutoScroll -> False];

@Gabriel I don't use SelectionEvaluate because I select whole cell and I want to evaluate only output-style boxes in it. Without ToString examples like a+b don't works. I edit my post to correct the problem with exponents. – ybeltukov Oct 21 '13 at 10:27