c# - remove character like |n, |p, |q from regex -


|p,|q string expression example "what |n abc |p"?

it can character after '|'

i tried

"[\\|.]"  

but no success.

no need put | , . inside character class engine treat them literally. character class [\\|.] searching 1 character out of \, | or . (literally).

what want match on |. (read: character | , 1 other character after it).

string strregex = @"\|."; regex myregex = new regex(strregex, regexoptions.none); string strtargetstring = @"what |n abc |p"; string strreplace = @"";  return myregex.replace(strtargetstring, strreplace); 

every found match replaced nothing.
(code taken regexhero.net)


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -