.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

Extract src and alt tag from img tag

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :.NET Framework
Hi!I have a regex function that extracts the src attribute from a img tag and puts the img inside of a link, now i also need to extract the alt attribute.Can't get it right.Here's my code:Dim regex As New Regex("(?<first><img[\s\w]+?.*?src=[""|'])(?<thesrc>.*?)(?<last>[""|'].*?[/]?>)", RegexOptions.IgnoreCase Or RegexOptions.CultureInvariant Or RegexOptions.IgnorePatternWhitespace Or RegexOptions.Compiled)' This is the replacement stringDim regexReplace As String = "<a href=""${thesrc}"" rel=""gallery"">${first}${thesrc}${last}</a>"' Replace the matched text in the InputText using the replacement patternstrContent = regex.Replace(strContent, regexReplace)Return strContentHow could i get the alt tag like i do with {thesrc}?

View Complete Post

More Related Resource Links

extract picture data from a string


dears,advance thanks.can anybdy help to solve my problem which is describing below.

Example- %%D1,100,0,0004[data...][0d0a]

Head - %%D1
Amount of data package -100
The data package No. - 0
Data Length -1024 (0004 (low bit in front, high bit in back) 0004= 0x0400=1024;)

data- Original Picture data -1024(maximum)
Tail -0x0d0a
Data in hex

from the above example i want to extract picture data and need to store in to the sql table.sql table columname is image and datatype is also image.after that i wanted to display this image column to an aspx page.

expecting help asap.

How to extract a schema from a sql server database



  I need to extract or get the schema from tables in my databse and what is the best way to do it. Is there any third party tool to do it??


Any idea will be appreciated..



Extract a number from WebBrowser component

Basically, I am using this program that goes to this webpage, and tells the user how much points they have.   <div class="profileresults"><b>Gift Point Balance: 485</b></div>   That's the html. I am looking the extract just the 485 part. Just to note, this number value can be anywhere between 5 and 1000 or HIGHER. I know I'm going to have to use regex for this, so please help me, as I have no clue what do work from next.    

How to extract subjects and objects from a sentence

Hi all I am supposed to do these few things in my program but I got stuck.  Step 1: To split and count the number of words in the sentence input by users. Step 2: To extract subjects and objects e.g. nsubj, pobj, etc from the sentence input by users. Or to remove the bad words (stop words) from the sentence with the database of the stop words. Step 3: To check words that match the clues and patterns. E.g. Jones was born in 1975; the matching words are Jones, born, 1975. The clues and patterns are all in sql database. Step 4: To check proper noun - capital word for each starting word) Here are my half-way done codes. I hope there are someone can help on advising me on how to continue it. Imports System Imports System.IO Imports System.Text Imports System.Text.RegularExpressions Module Module1 'To count the words Public Function getWordCount(ByVal InputString As String) As Integer Return Split(System.Text.RegularExpressions.Regex.Replace(InputString, "\s+", Space(1))).Length End Function 'To eliminate stop words and replace with a space Public Function StripStopWords(ByVal s As String) As String Dim StopWords As String = ReadFile("C:\Users\jaimiechin\Desktop\stopwords.txt").Trim Dim StopWordsRegex As String = Regex.Replace(StopWords, "\s+", "|") ' about|after|all|also etc.

RegEx Request - Extract an tag from string...

Hello, Can anyone give me a regular expression that will extract the <img> tag from a string.  I am receiving descriptions from an rss feed and the description contains an <img> tag in the text.  I want to extract the <img> so that I can display it in a different location on my page. I have fooled with some regular expressions, but my knowledge of them is not very good. Thanks in advance for any help!!

Extract text from html source code

i wan to extract Desired Title,Desired Text and Desired link from Webpage source code and paste in richTextBox1. <a href="/site/show/link/0/type/0">Desired Titl e</a> <a title="&lt;b&gt;Text preview&lt;/b&gt; &lt;br/&gt;Some Text" class="pdtip" href="/site/show/link/0/type/0">Text</a><br />Desired text <br /> <label class="url" for="">http://Desiredlink.com </label> Output: Desired Title Desired Title Desired link How can i do this?

How to extract City State Zip using Regex match

Hi there - I am parsing a file which contains customer address in the following 2 formats:   Format #1 12345 Melrose Place New York NY USA 12987     Format # 2: 12345 Melrose Place New York NY 12987   I need to put the data into Address, City, State and Zip fields. I am able to parse and put the data (specifically line 2) in the fields for format #1 but am having issues doing the same for format # 2 because format # 2 doesn't have USA as a reference point. Below is my code if any expert can help that will be appreciated Dim AddressChunk As String = tokenizer.NextToken() If AddressChunk.Contains("USA") Then _State = AddressChunk.Substring(AddressChunk.IndexOf("USA") - 4, 2).Trim _City = AddressChunk.Substring(0, AddressChunk.IndexOf("USA") - 4).Trim _Zip = Regex.Match(AddressChunk, "\d{5}").Value Else _Zip = Regex.Match(AddressChunk, "\d{5}").Value _State = AddressChunk.Substring(Regex.Match(AddressChunk, "\s[a-zA-Z]{2}\s\d{5}").Value - 5).Trim _City = End If

Inserting a row on an extract flat file

Hi, I want to add in a header row to an extracted file. The file contains 5 columns of data but I only want to add in a 5chr id (stored in a variable) in the very first line of the extracted flat file.. please can you assit and tell me the best way of doing this..

how to extract the zip or rar file using C#

hi, i am doing a project using C#. i am new to this area. the task is to extract the zip or rar file using C#. in my windows form have a text box and button in the form. i will give the zip or rar file. when i click that button. it must automatically extract the file and shows contents of that file in to the other form or file.. i don't know how to extract that zip or rar file using C#. if u know please share your idea.

extract data from WSS Database

how to extract data from WSS Database.We have TFS 2008 with WSS 3.0. By querying,programmatically?any help is appriciated?

extract the documents from WSS database

Hello, Can anyone guide on extracting documents from WSS Database.Any alternative ways??

How to extract different sources into one destinations table?

Hi All, They have different  sources like flat file,xml file,execl file, oracle etc.All sources have similar data fields but data is different from each source. How to extract into one  sqlserver table?

How do you extract data from the xml attachment of an incoming email and set it as metadata in a doc

Hi, I currently have a document library that contains InfoPath forms. As a form is loaded into the document library I need the data to be extracted from the infopath file and then set as properties/metadata of the file. The infopath forms will be sent to the SharePoint site as an email attachment. So basically, an email is sent to the SharePoint server with an InfoPath form as an email attachment. The InfoPath form needs to be extracted from the email and uploaded to the document library and at the same time updating the document library metadata with the infopath form data. This has been done using Visual Studio but can this be done using SharePoint Designer 2010 now that we have upgraded our site to SharePoint 2010? Any guidance will be greatly appreciated! Thanks Michael

extract page view to library

i have a infopath form, within this form there 10 view availeble. a few pages is just for entering a company details and some extra data like meeting request, intervention, ... than there are some page just for a travel request: on a meeting or intervention these are different pages because some extra data is needed. those pages have a button that saves the document and send the form to a different form library. now the whole form is transported to the new library. is it possible that i can export ownly the travel view page, to the new form library?   regards  

How to Extract specific information

Is there a way to extract only certain information with the use of javascript?If i have the following line of code<A href="Person.aspx?q=83537">Prince Bahawal () Abbas Abbasi</A> and I would like to extract 83537 part from that line, in a JavaScript function.is this possible?

Extract String using RegEx

HelloI have below data in string format in a field in table and would like to parse the name from the quantity. The name should be anything before it hits a numeric numberin below example CHLORPHENIRAMINE is the name. i really appreciate if i can get a regex to extract the name from below string                                    "CHLORPHENIRAMINE 8MG CAP SA",                                    "CHLORPHENIRAMINE 12MG CP SA",                                     "CHLORPHENIRAMINE 4MG TABLET",                                     "CLEMASTINE FUM 2.68MG TAB",             &n

extract date from text string - Transact-SQL

Hello, I have a field in my database with an archived date... (Giampaoli  Live Oak, Almonds Archive 09/16/10) I need to be able to extract the date from this, then perform a datepart function on it... How do I extract the date into it's own value using just SQL? Thanks, Wes
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