473,394 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

getting data from string

Hi all,

I have a string containing html code and want to extract data between action
en/or href. For example: href="www.google.com" then I want to detect the href
string and get the data between "" (www.google.com).

How is this best done,

Regards
Stijn
Nov 16 '05 #1
3 1070
Hi Stijn,

I would say the best method to extract strings from strings would be by
using Regular Expressions.

Since, in this case you need the value in between the quotes, you could use
the :q construct.

HTH,
Rakesh Rajan

"Stijn Goris" wrote:
Hi all,

I have a string containing html code and want to extract data between action
en/or href. For example: href="www.google.com" then I want to detect the href
string and get the data between "" (www.google.com).

How is this best done,

Regards
Stijn

Nov 16 '05 #2
Here is a regex that I wrote some time ago to find image references. You
should be able to adapt it for use in finding anchors. It is somewhat
complex and it has been awhile since I have used it so it probably has some
bugs in it, but this should get you started.

<img.+?src\s*=\s*((["](?<xref>[^"]+)["][^>]*[>])|(['](?<xref>[^']+)['][^>]*[>])|((?<xref>[^\\s>]+)[^>]*[>]))

"Stijn Goris" <St********@discussions.microsoft.com> wrote in message
news:A8**********************************@microsof t.com...
Hi all,

I have a string containing html code and want to extract data between
action
en/or href. For example: href="www.google.com" then I want to detect the
href
string and get the data between "" (www.google.com).

How is this best done,

Regards
Stijn

Nov 16 '05 #3
Stijn,

For that is in dotnet the MSHTML class what covers the DOM.

However it is very hard to use (it has an endless amount of interfaces),
therefore take a lot of people probably the regex.

Just my thought,

Cor
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: lawrence | last post by:
If I'm pretty sure there is just one form on the page, can i do this? var myForm = document.forms; If I'm not sure about the form, is it safer to do this? if (document.forms) { var myForm =...
5
by: Brian Henry | last post by:
I have a page which reads an article from the database it has 1 text box, 2 dropdown lists, and a longreat HTML text box. I load the information from the database when the page is set to edit mode...
1
by: thangchan | last post by:
Hi all, i am getting SQL update problem. as below ======================error messages ======================= Server Error in '/CMS' Application....
0
by: sags | last post by:
Hi , Iam a new uesr of this group. I have a small doubt . Iam using the code mentioned below to retrive the data from tab delimited text file ., but Iam getting all the columns of the text file...
1
by: momo | last post by:
Can some take a look at this and tell me what I am doing wrong and how to fix it. I an new to ASP.NET Getting Name "GetMsAccessOldebConnection' is not declared " Error <%@ Page...
4
by: R.Manikandan | last post by:
Hi In my code, one string variable is subjected to contain more amount of characters. If it cross certain limit, the string content in the varabile is automatically getting truncated and i am...
3
by: ist | last post by:
Hi, I am trying to get (and transfer over ASP.NET) some encrypted data from some MySQL fields. Since the data contains many unicode characters, I tried to get the data as a series of ASCII...
0
by: TG | last post by:
Hi! Once again I have hit a brick wall here. I have a combobox in which the user types the server name and then clicks on button 'CONNECT' to populate the next combobox which contains all the...
0
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ...
2
by: Andrew Cooper | last post by:
Greetings, I've got a website that has several pages with DataGrid controls on them. The controls are bound to Object Datasources. On one of the pages I keep getting a "Timeout expired. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.