473,788 Members | 3,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Extract specific texe from a string ?

1 New Member
Hey ive got a simple problem here im using Forum.Document. Links to extract all links from a webpage loaded into a webbrowser control .

Some of the links contain url variables like the subscribe link above http://bytes.com/subscription.ph p?do=viewsubscr iption . Each one of these links getspassed through a foreachloop .

I use String.Contains () to filter out all links that dont contain ?do= the url paremer in this case but after that im stuck.

Is there any way to extract the value of a specific url parameter anywhere in a string . ive tried string.split and taking the first char (after the =) but that can only split strings based on one char = so other url parameters get through.

Can anyone suggest a way to extract a specific url parameter
Oct 4 '09 #1
2 2498
GaryTexmo
1,501 Recognized Expert Top Contributor
You can use the string.substrin g method, here's the MSDN page.

http://msdn.microsoft.com/en-us/libr...8VS.71%29.aspx

Another, some might say better, option would be regular expression matching. I'm absolutely terrible with regular expressions, but I know you can use them to match on a string and return the matches. I'll leave you to look into how to do it, but a google on "C# regular expressions" should turn up a plethora of information for you.

Good luck!
Oct 4 '09 #2
Plater
7,872 Recognized Expert Expert
You may also be able to use the Uri class for this. (One of the constructors takes a string)
Just instanciate with your url string, and then you can use the properties on it I think?
Oct 5 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
30203
by: rdraider | last post by:
Is there a function that will extract part of a string when the data you want does not occur in a specific position? Field "REF" is varchar(80) and contains an email subject line and the email recipients contact name Example data: Rec_ID REF 1 Here is the information you requested (oc:Johm Smith) 2 Thanks for attending our seminar (oc:Peggy Sue Johnson)
3
2551
by: ano1optimist | last post by:
I've got the code to search through a directory for word documents, open the doc, search for specific text... but I'm trying to extract data that immediately follows the selected highlighted text. I can't figure out the correct syntax to give me the text that follows the currently selected text. Here is my code: Set objword = New Word.Application objword.Documents.Add "filename.doc" objword.WindowState = wdWindowStateMaximize...
9
16985
by: Sharon | last post by:
hi, I want to extract a string from a file, if the file is like this: 1 This is the string 2 3 4 how could I extract the string, starting from the 10th position (i.e. "T") and extract 35 characters (including "T") from a file and then go to next line?
4
8599
by: Mehdi Mousavi | last post by:
Hi, I need to know how to extract a specific icon (32x32 for instance) from an icon file that contains more than one icon size? Any help would be highly appreciated, Cheers. Mehdi
13
2723
by: Tony Girgenti | last post by:
Hello. Using VS.NET 2003 VB. If i have a string similar to the attached, how would i extract the "Truckname=" data from it in a loop and stay in the loop until the end of the string is reached ? As you can see the first truckname is "284165". The next truckname is "284193" Any help would be gratefully appreciated. Thanks,
2
12344
by: tthomas | last post by:
Greetings, I am using CDO.Message to send email messages from my application. I now need to send email to existing distribution lists in our Global Address List. However, our exchange server blocks sending to distribution list (i.e. distribution list is named MyDistList and its email address is MyDistList@mycompany.com) from SMTP email. I have searched in vain for an example of VBA that will extract the email addresses of members of...
6
2807
by: mandibdc | last post by:
I need to extract some elements from a very large XML file. Because of the size, I'd like to work with it on my Linux machine as a text file. Basically, I am going to have a list of specific strings I'm searching for. For each string, I need to search through the XML file, and when I find that string (in the tag <code>), copy the entire <item> XML element that the code appears in, into another text file. The XML document is comprised...
1
4577
by: rcamarda | last post by:
I'd need to have a function that allows me to extract 'fields' from within the string I.E. (kinda pseudo code) declare @foo as varchar(100) set @foo = "Robert*Camarda*123 Main Street" select EXTRACT(@foo, '*', 2) ; -- would return 'Camarda' select EXTRACT(@foo, '*', 3) ;-- returns '123 Main Street' select EXTRACT(@foo, '*', 0) ;-- would return entire string select EXTRACT(@foo,'*' , 9) ;-- would return null
5
5765
by: Steve | last post by:
Hi all Does anybody please know a way to extract an Image from a pdf file and save it as a TIFF? I have used a scanner to scan documents which are then placed on a server, but I need to extract the image of the document (just the first page if there are multiple pages) and save it as a TIFF so I can then use the Tesseract OCR to get the text in the image.
0
9498
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.