Solved

escape sequence in c#

Posted on 2006-07-11
4
1,161 Views
Last Modified: 2012-06-21
I came asross code for sorting datagrids with arrow images
 http://aspnet.4guysfromrolla.com/demos/dgExample37.aspx

is there a better way to achive this using c# (can't stand vb code!!)

if not, then

I would like to translate this to c# code.
particularly the escape sequence:

Regex.Replace(c.HeaderText, "\s<.*>", String.Empty)

ie how do you write this  "\s<.*>"  in c#, and what does \s mean?

Thanks
Ugo


0
Comment
Question by:ugougbor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 125 total points
ID: 17083772
\s is a regex shorthand for empty space.
. is the symbol that represents any character
* means zero or more
< and > match themselves

You can translate that statement to the following in C#:

Regex.Replace(c.HeaderText, @"\s<.*>", string.Empty)
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17083810
Or:

    Regex.Replace(c.HeaderText, "\\s<.*>", string.Empty);
0
 
LVL 18

Expert Comment

by:Ravi Singh
ID: 17083812
Sorry, \s matches any white-space character so that includes new line, carriage returns, tabs...
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 17083878
Just one clarification to Zephyr__ answer the Regex meta character \s stands for any single white space character such as space, tab, newline, carrage return, line feed, and some others.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question