How to extract and assign output of Free-Form input to a variable?

Selecting a Free-Form input cell with the mouse I can query something like:

convert 1 atm to pascals


and get as a result

101\[ThinSpace]325\[ThickSpace]Pa (pascals)


I can take that number and manually enter it into a variable (I can't cut and paste it since the space turns the cut and pasted value into (101)(325)).

Is there a way to just extract the numeric portion of the result and assign it to a variable?

-

You can use a slightly different query: (convert 1 atm to pascals)/pascals

The number in this case is a regular number (not a string or some other exotic construction.)

If you instead use Wolfram|Alpha query (shortcut ==), you get a lot of results:

with a + icon on the right of each. Clicking on the + gives a menu where you can choose a format:

In particular the 'Number data' format will then paste something like

WolframAlpha["convert 1 atm to pascals", {{"Result", 1}, "NumberData"}]

101325


into the notebook. This doesn't help you much the first time, but can be used programmatically for subsequent calculations.

-
WolframAlpha["(convert 1 atm to pascals)/pascals", {{"Result", 1}, "NumberData"}] works very nicely. Thanks! – Peeter Joot Mar 4 '12 at 5:30

I am not sure there is a simple solution to this.

result = %;
result //FullForm


WolframAlphaResult["convert 1 atm to pascals", List[List["Result", 1], "Content"]]

Copy As... and various other attempts to get at the result don't work.

Interestingly, copying and pasting the result into somewhere other than Mathematica (e.g. an answer window here) gives the following, which suggests a way around the issue.

\!$$\* FrameBox[ StyleBox[ FormBox[ StyleBox[ RowBox[{ RowBox[{"101", "\[ThinSpace]", "325"}], " ", " ", "\[ThickSpace]", " ", StyleBox["\<\"Pa\"\>", FontFamily->"Helvetica", FontSize->Smaller], " ", StyleBox[ RowBox[{"\<\"(\"\>", "", "\<\"pascals\"\>", "", "\<\")\"\>"}], StripOnInput->False, LineIndent->0, LinebreakAdjustments->{1, 100, 1, 0, 100}, LineColor->GrayLevel[0.6], FrontFaceColor->GrayLevel[0.6], BackFaceColor->GrayLevel[0.6], GraphicsColor->GrayLevel[0.6], FontFamily->"Helvetica", FontSize->Smaller, FontColor->GrayLevel[0.6]]}], ZeroWidthTimes->False, LineIndent->0, LinebreakAdjustments->{1, 100, 1, 0, 100}], TraditionalForm], "Output", ScriptLevel->0, FontFamily->"Times", FontSize->14, Background->None], BaseStyle->{Plain}, FrameMargins->10, FrameStyle->GrayLevel[0.85], RoundingRadius->5, StripOnInput->False]$$


The part specification might be specific to the case in question, but something like the following seems to work.

 ToExpression@
StringReplace[ToBoxes[result][[1, 1, 1, 1, 1, 1, 1, 1, 1]],
x__ ~~ "\[ThinSpace]" ~~ y__ :> x ~~ y]

-