.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

replace tab in the string using regular expression

Posted By:      Posted Date: October 14, 2010    Points: 0   Category :.NET Framework
      I want to replace tab space with "|" in the string using regular expressions.
I have tried for

Dim strTabString AS string = "A             B             C "                 
TextBox1.Text = Regex.Replace(strTabString , "\t", "|")
But i m not getting the results.


View Complete Post

More Related Resource Links

How to read string end with question mark in regular expression?

Hello, I'm facing problem when I read string which is ended by question mark. I use in my code as the following. \"?(?<myfield>[^\"]?.*[^\"?]?)\"? If string is ended by question mark, it's not working. Please help me to solve my problem. Thanks. Co Coe

Regular expression: Replace anything that isn't alphanumeric with a space?

Hi there,I'm writing a function in C# that will clean up a filename that a user might upload.One of the requirements is to replace any character that isn't alphanumeric with a space, but I can't seem to get the regular expression working to do so?I've include my code below, thanks for any help :)// Replace miscellaneous characters with a space inputFilenameRegex = new Regex(@"^[a-zA-Z0-9]"); inputFilename = inputFilenameRegex.Replace(inputFilename, " ");

Regular Expression for looking for Colons (:) in a string

Hi I am really struggling with this! Using the regular expression validator I created an expression, thus "\:" to show an error message if the user tries to enter in a name that contains a colon. What I am getting is the error message showing even when there is no colon (:) in the string. What am I doing wrong? Thanks    

Regular expression - exclude certain string

Hi all,I have the following regular expression replacement:<add key="^/([^/]*)\.aspx\?" value="/default.aspx?pagename=$1&"/>What this is used for is URL re-writing, i.e. if a page comes in with the path "/test.aspx", it goes to the actual path which is "/default.aspx?pagename=test"This works fine, but it catches all page names. I would like to exclude a particular page name so it is not rewritten, for example if the page was called "exclude.aspx" it would not rewrite to "/default.aspx?pagename=exclude" but stay as "exclude.aspx".How do I modify ^/([^/]*)\.aspx\?so it excludes a certain page name?Thanks!

Web expression 3 and find/replace with a regular expression

I'm am trying to  delete some code in a javascript

<a href="JavaScript:openPopImg('images/Burgess-Rufus1.jpg', 'Rufus Morgan Burgess', '296', '589')">  I want to delete  ', 'xxx', 'xxx')  throughout the web.  I can not get  a regular expression going that will work; .i.e.  ^(\'\, \'[0-9]{3,}\'\, \'[0-9]{3,}\' \)) Am I anywhere near right or is there another way to do this?  Thanks.

how does the string validation work for this regular expression?

 _strInt = value.ToString();
Regex objPattern = new Regex("[^ a-zA-Z]" ); if (objPattern.IsMatch(_strInt)) { return   new ValidationResult(true , null );
   } else return new ValidationResult(false , "Value must contain only alphabets" ); } }

if i pass a valid expression as "abc" .. its Failing .
Can some1 explaing how it's failing .

Regular expression or logic to replace UL LI tags


Hi All,

I have HTML which can contain ordered lists like


resulting as

  • a
    • l
    • m
      • x
      • y
    • n
  • b
  • I want to achieve following replacement

    firstLevel li with bullet (for which I will find the character)

    secondLevel li with circled bullet (for which I will find the character)

    thirdLevel li with squared bullet (for which I will find the character)

     Can this be achieved with regular expressions? Please note contents can be dynamic

    Regular expression to replace


    Hi Everybody,

    I have an HTML with content some thing like

    <div style="margin-left: 40px">a <strong>b </strong><em><strong>c</strong></em></div>

    What I want to achieve is

    <div style="margin-left: 40px"> to be replaced with &#09;

    And </div> with &nbsp;<br> without touching inside contents which are dynamic

    I thought this can be achieved using regular expression Regex.Replace but not worked on regular expression.

    Can anyone help with proper approach?



    How to use Regular Expression to find a particular pattern and its index in the string??



    I need some help here. I have a document containing some string like the following:


    Now what I need is that I need to extract this "BusinessGoal" which as you can see, is 32 characters ahead after "-" (hyphen) and change it's case to uppercase.

    The real challange is that, This "BusinessGoal" should only be replaced only and only where there is "Ref-<any 32 characters>" before it and not all. So if I find something like TypeName = "BusinessGoal"  it will be simply ignored.

    So how am I going to make that reg Ex. I think it would be a combination of Regex and String Api. 

    Kindly help me out.

    Thanks and regards



    Fahad Ali Shaikh

    Regular expression: String start with
    end with
    which ever comes first


    Regular expression is hard. Can anyone help me with this one?

    I need to get XYZ 123 and abc 134

    from this html code below:


    <div>XYZ 123<br />

    <div>abc 134</div>


     Thank you in advance!

    regular expression thar allow except ".aspx" this string


    hi i am new in regular expression

    can anybody understood me how can i make a regular expression that

    allow all the mismatch case  and don't a match case

    ex: ".aspx"

    ( when i put any thing in text box it allow ----a ,ab ,adn.jpg ) result=true

    (but when i put =.aspx ) result= false  

    Regular expression for splitting string



    i have a string like this 


    i want to split like this





    pls help me 

    thanks in advance

    Regards, Anoop

    Regular Expression Match Exact String


    I'm looking for a regular expression that satisfies one of the two conditions (Reg Expression OR Exact String Match W/ Underscores) listed below.





    Thanks in advance

    Security Briefs: Regular Expression Denial of Service Attacks and Defenses


    Microsoft security expert Bryan Sullivan believes denial-of-service blackmail attacks will become more common as privilege escalation attacks become more difficult to execute. He demonstrates how to protect your apps against regular expression DoS threats.

    Bryan Sullivan

    MSDN Magazine May 2010

    Help with regular expression


    I am using this regular expression: /.*-lyrics-.*$

    and I need the expression find urls like this:

    and it do really does that!

    The problem is that it finds also this URL:

    Whar regular expression should I use to exclude urls that end with /lyrics ?

    Thanks :]



    Need regular expresion for this string


    Hi All,

    I would be grateful if some one can provide me regular expression for extracting just  myhomepage from below url:


    Thanks in advance for replying(as always).

    With Warm Regards,


    Regular Expression to Match
    in HTML


    Here is the kind of text I want to match via a regular Expression

    The id="dgSchedule" is always present in the TAG but its location may differ

    The table is span over multiple line/contains white spaces/tabs...

    I have the regular expression to match the start and end tag respectively over a single line

    \<table .*\>


    The problem is to match the whole table span over multiple lines

    <table cellspacing="0" rules="all" border="1" id="dgSchedule" style="border-style:None;height:100%;width:100%;border-collapse:collapse;">
    	<tr class="blackbar" align="center" style="background-color:#7FB4DE;font-family:Verdana;font-weight:bold;height:20px;">
    		<td>From Place</td><td>To Place</td><td>Time</td><td>Bus Type</td>
    	</tr><tr style="background-color:#DEECF5;">
    	</tr><tr style="background-color:#EFF5FA;">
    	</tr><tr style="background-color:#DEECF5;">
    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend