.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

find a string beetwen tag

Posted By:      Posted Date: September 27, 2010    Points: 0   Category :ASP.Net

hi guys

i have a string contain :

kasjbdfkjasbdf klsajdfl

ajbfk  <html> ... </html> ksadfksadfwie...

now i wnat to find string beetwen <html> tag

(with regex)

how i can do that?

tnx guys

View Complete Post

More Related Resource Links

Find first word in string??

Hey I would like to ask does anyone know how I can find the first word in a  stringif my String = apple; cat; dog; horse  I would like to get the first word ... appleThank you for taking the time to help meI really appreciate this :)RegardsJake

how to find multiline string literals (@"bla") in .cs files (C# sourses)

Hello, My app searches a key word over .CS file (C# sourse) and I want to exlude all string literals because of possability of appearance of key word within this string which is unwanted. I've already composed a regex for common strings - like this - string s = "bla \"bla\" bla" ; This is highlighted correctly by ((?<!(\\|@))".*?"(?<!\\")) But I can't fix up the case with multiline strings. For instance - string s = @"bla ""bla"" bla" ; or string s = @" bla ""bla"" bla" ; In such type of strings there is a rule - within strings can be quotes but only if they are doubled. These are correct examples - @"bla """"""""bla """""" bla" @""" bla """"bla bla" @""""" bla"" bla bla""" These are incorrect - @"" bla "" bla bla"" @"bla """ bla bla" I have some clues - I know how to catch even quantity of quotes - by this regex - ((?<!")("")*(?!")) how to catch odd quantity - ((?<!")"("")*(?!")) how to catch strings which have even quantity of quotes, ex

Pass index number and find the char in a string?


How do i find the charactors in teh first index and the last index number of a string? 


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

Program to find first non repetable character in a string without using any buitin function?


Program to find first non repetable character in a string without using any buitin function?

Need a function to find and format initials in a string


the following rules need to be applied to initials:

- if a two letter initial is required, type them in capitals with no space or stops between them. (eg. BB Construction)

-If a name requires an initials follow it with a space with no stop (eg.  A Sander Davids)

- initials should always be in caps

I need a function that can do the above, any help will be appreciated.


Get Public String in HTML doesn´t work in this case?

Hi, I am trying to retreive a public String in code behind in the HTML code like below but the compiler says that there is Illegal characters in path. I wonder if it is possible to pass a public String here in this case like this ?  <%@ Page Language="C#" ValidateRequest="false" AutoEventWireup="true" CodeFile="Hello.aspx.cs" Inherits="Hello" %> <%@ PreviousPageType VirtualPath="<%# previousURL%>" %> (code behind): public String previousURL = "someURL";  

HtmlHelperExtensions in MVC2 return a HTML string, unencoded. In MVC3 this tring is encoded!

 HtmlHelperExtensions in MVC2 return a HTML string, unencoded. In MVC3 this string is encoded! How can I return unencoded HTML to a Razor view in MVC3? 

Html.DropDownList using a List

This has to be a simple thing, but for whatever reason, I'm just not finding it. I want to use the HTML Helper function to create a DropDownList based on a List<string> (and actually have it bind to the data field on the model).  The simplest example, I suppose, would be: <%: Html.DropDownList("Material", new SelectList(new[] {"Wood","Brick","Metal"})) %> This creates the items in the drop-down, but of course, there's nothing in this line that would bind it to my model (model.Material).  I've done drop-downs with collections of models, where you can bind the Data and Display attributes to properties of the class, but I don't have a class here, just a List. Any ideas?

Render controls from html string


Iam getting the below string in a variable"result" after xslt tranformation.
if i do Page.ParseControl(result) iam able to render controls to the page.
But the requirement is different.
I have 4 place holders in that aspx page.I need to bind div id="Section1" to placeholder1,
div id="Section2" to placeholder2 and similar the other two sections also  to the corresponding place holder.
Please help me out how can i loop and add controls to corresponding place holder.

result =

<div id="Section1" xmlns:asp="remove">
  <asp:Label id="lblSection1" runat="server" text="section1" />
  <asp:RequiredFieldValidator ErrorMessage="Mandatory Field-1" runat="server" ControlToValidate="txtNameSection1" />
  <asp:TextBox id="txtNameSection1" runat="server" />
<div id="Section2" xmlns:asp="remove">
  <asp:Label id="lblSection2" runat="server" text="section2" />
  <asp:RequiredFieldValidator ErrorMessage="Mandatory Field" runat="server" ControlToValidate="txtNameSection2" />
  <asp:TextBox id="txtNameSection2"

Call server control from HTML string


Hi you guys, is there any way to create a server control from html string, i mean in code behind i have a string like this:

string html = "<asp:CheckBox ID=\"CheckBox1\" runat=\"server\" />";

So how to insert it into aspx page and when the page is rendering, it convert my string as i write it own in the webpage
Hope you guys can help
Thanks in advance!

Html + string Builder



Can anyone explain me what is hapening? I have a piece of code like this, and i'm using StringBuilder to create a html page however there's something worng.

sb.Append("<td " + strColorRef + " >" + item.MarDat == null ? "" : ((DateTime)item.MarDat).ToString(formDatMar) + "</td>");

value of  strColorRef  is  style="color: #FF8000;"

                foreach (var item in listaAlert)

value of  item.MarDat == null ? "" : ((DateTime)item.MarDat).ToString(formDatMar) is  11-Out

value of formDatMar is dd-MMM

The final result is  11-Out</td>

What is going on, i can't understand that.  

Add Runat server to all element in html string



I have one html string in DB like below

<div style="padding-left: 200px; padding-top: 20px">
        <div style="text-align: left;padding-top:10px">
            <input id="Text1" type="text" /></div>
        <div style="text-align: left;padding-top:10px">
            <input id="Text2" type="text" /></div>
        <div style="text-align: left; padding-top: 10px">
            <input id="Button1" type="button" value="Submit" /></div>


i wan to render this in aspx page. but before this i want to all runat server to all html control in above string


<div style="padding-left: 200px; padding-top: 20px">
        <div style="text-align: left;padding-top:10px">
            <input id="Text1" runat="server&

SQL: Stripping HTML tags from a string by calling a function



I have a function that strips HTML from a string. But it lies in a different database to the batabase that is being queried.

My question is: How do i call that function in my query?




remove unwanted parts of a string of html tags


hi,all, I have a string of tags like:

<A href

How to Encrypt Query String Parameters in ASP.NET

Encrypt Query String Parameters in ASP.NET.u can send secure data one page another page u can also use query string to encrypt

Connestion string create any database server

This links important to how to create connection string to any data base sever.
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