String into object
To convert a string of xpath into object in Ranorex :
1) Include the library above the namespace -- using Ranorex.Core;
2)
RxPath path="/dom[@domain='localhost']//div[#'silverlightControlHost']//button[@name~'.*supplinvcs.*']";
Ranorex.Button button = Host.Local.FindSingle(path);
WinForms.MessageBox.Show(button.Text.ToString());
Ref:
http://www.ranorex.com/forum/add-regular-expression-when-using-a-variable-t2874.html