SolvedExtract string

Posts 1–9 of 9 · Page 1 of 1
Extract string
Hi,
Is there a way to extract 'unknown' text/string from a webpage?
HTML Code:
Code:
<input type="text" value="The value randomly generates.">
I want to extract that random string to my textbox.
This Text input in the webpage has no ID/Tagname so I can't find a way to get its innerText.
Any help is appreciated
you can narrow it down by selecting only the <form>...</form> text. How many <form>'s are on the page?

Once you have a variable containing just the <form> string, how many <input> elements does it have? and how many <input> elements does it have that only have 'type' and 'value' set?
Quote Originally Posted by abuckau907 View Post
you can narrow it down by selecting only the <form>...</form> text. How many <form>'s are on the page?

Once you have a variable containing just the <form> string, how many <input> elements does it have? and how many <input> elements does it have that only have 'type' and 'value' set?
Only two with the "<input type="text"" thing, however, one of them has Name and ID.
perfect, so

1. pull out the text from "<form >" to "</form">
2. pull out each <input type="text"..>
3. check if <> tag contains the words Name or ID and you'll know if it's the correct one ?
Quote Originally Posted by abuckau907 View Post
perfect, so

1. pull out the text from "<form >" to "</form">
2. pull out each <input type="text"..>
3. check if <> tag contains the words Name or ID and you'll know if it's the correct one ?
Well, the question now is, how to pull out "<input type="text" value="The value randomly generates.">" from the webpage source?
String.IndexOf() and String.SubString() ?

ex. To separate "myemail@myprovider.com" into 'email_name' and 'provide_namer' (hint: separated by the @ character)

You'd find the Index of the "@" character, using .IndexOf(), and copy the string, using .SubString() - from its first character up until the @ character. To get the 'provider' part of the string you'd .SubString() starting at the @ character's index + 1 and go to the last character (in this example).
Quote Originally Posted by abuckau907 View Post
String.IndexOf() and String.SubString() ?
I can't find it anywhere, I never used the extract thing before.
Mind helping me with the code?
Read a few tutorial on "string manipulation vb.net" ..at least see a few examples of the functions being used and then come back if you have a question about your specific problem; I'm not teaching you how to use the functions, there are already well written tutorials out there; sorry, I don't have a link.

Most books would probably cover this in a section explaining "Strings". Do you have access to a book? Surely there are some free on the internet?
Quote Originally Posted by abuckau907 View Post
Read a few tutorial on "string manipulation vb.net" ..at least see a few examples of the functions being used and then come back if you have a question about your specific problem; I'm not teaching you how to use the functions, there are already well written tutorials out there.
Can't find any tutorials, I don't know why and how. lol
Edit: @abuckau907 Used Regex & Regex.match and worked as I wanted, Thanks for the help.
Posts 1–9 of 9 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us