You might have forgotten to add an @ in front of the string to preserve the escape for the regexp engine. Alternatively, you could use two slashes instead to escape the escape character so it reaches the regexp engine.
string exp1 = @"\?"; or string exp2 = "\\?"; On 6 June 2013 21:07, Ian Thomas <[email protected]> wrote: > Yes, string.replace is good enough – there wouldn’t be much processing > penalty in what I’m doing. > > It’s just annoying that I can’t remember (or even find) how to do this in > regex – I thought just escaping \ the ? would be the way. > > > > ________________________________ > > Ian Thomas > Victoria Park, Western Australia > > > > From: [email protected] [mailto:[email protected]] > On Behalf Of David Burstin > Sent: Thursday, June 06, 2013 6:41 PM > To: ozDotNet > Subject: Re: regex - how to remove questionmark > > > > If it doesn't have to be a regular expression why not just use > string.replace? > > If it does have to be a regex then I need to get my notes out. > > On 06/06/2013 8:35 PM, "Ian Thomas" <[email protected]> wrote: > > I am confusing myself in trying to use regular expression to remove a > questionmark, which may be anywhere in a string. Can someone give me the > right way? > > > > ________________________________ > > Ian Thomas > Victoria Park, Western Australia
