jorge Posted February 5, 2004 Posted February 5, 2004 (edited) ok my application get a string passed to is, but i only need a small part of it so how do i get it? GET /index.htm HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) Host: schrauwen.no-ip.org:81 Connection: Keep-Alive Cookie: useralb=Friends%2FSofie; isadmin=1; member_id=1; pass_hash=fc86d40ab841bf68d020223175187e65 I would like to get some information from that like: the filename and path after GET, User-Agent, and Cookies Edited February 5, 2004 by jorge Quote Jorge - http://www.blackdot.be/?page=apache.htm
Roey Posted February 5, 2004 Posted February 5, 2004 Regular Expressions are really powerful for identifying areas in strings. Here's a simple example: Dim s As String = tvwBillOfMaterial.SelectedNode.Text Dim re As New System.Text.RegularExpressions.Regex("\(\d+\.?\d?\d?\d?\d?") 'finds the quantity from the nodes description string Dim m As System.Text.RegularExpressions.Match = re.Match(s) Quantity_From_Node_Description = m.ToString Hope it helps Quote
Procaine Posted February 5, 2004 Posted February 5, 2004 There are various was to go about this depending on the rigidity of the string. There are two useful functions here; myString.SubString and myString.IndexOf. The former returns part of the string, where you specify the first character to get, and optionally how many characters from that point to get. IndexOf returns the first index of a specific character or string. So, for example, you could Get the first index of "GET", the first index of HTTP, and get the characters between that. edit: or you could use regex :P Quote
jorge Posted February 5, 2004 Author Posted February 5, 2004 :confused: hmmmz can't seem to ger it to work Quote Jorge - http://www.blackdot.be/?page=apache.htm
*Gurus* Derek Stone Posted February 5, 2004 *Gurus* Posted February 5, 2004 That's a really good description of the problem. Come on... put in a little effort Jorge. Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.