string input = "text?here";
int index = input.LastIndexOf("?"); // Character to remove "?"
if (index > 0)
input = input.Substring(0, index); // This will remove all text after character ?
// add directive at the top
using System.Text.RegularExpressions;
string numberOnly = Regex.Replace(s, "[^0-9.]", "")