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
Solved

escape sequence in c#

Posted on 2006-07-11
4
1,158 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
  • 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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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