| | |
Screen Scrape remove spaces/line breaks between specified tags
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Aug 2008
Posts: 4
Reputation:
Solved Threads: 0
Hi,
I'm doing a screen scrape of a web page, which works with out any problems
What I want to do is replace the contents of tag, I can do this if the tag match exactly but in this page there are allot of blank spaces.
lbltest.Text contains the page being scrapped. The tag is formatted like this
I can't to a simple replace because of all the spaces. So I need to get it to look like this
Any ideas how I might do this?
Thanks in advance
I'm doing a screen scrape of a web page, which works with out any problems
What I want to do is replace the contents of tag, I can do this if the tag match exactly but in this page there are allot of blank spaces.
lbltest.Text contains the page being scrapped. The tag is formatted like this
VB.NET Syntax (Toggle Plain Text)
<li class="thisclass"> TheText </li>
I can't to a simple replace because of all the spaces. So I need to get it to look like this
VB.NET Syntax (Toggle Plain Text)
<li class="thisclass">TheText</li>
Any ideas how I might do this?
Thanks in advance
•
•
Join Date: Aug 2008
Posts: 4
Reputation:
Solved Threads: 0
Hi,
This is the method I used:-
http://www.dotnetjohn.com/articles.aspx?articleid=93
Not heard of that class
This is the method I used:-
http://www.dotnetjohn.com/articles.aspx?articleid=93
Not heard of that class
Regex is a Class that used for Regular Expressions. It is useful for Parsing.
For more detail, refer http://www.regular-expressions.info/dotnet.html
For more detail, refer http://www.regular-expressions.info/dotnet.html
KSG
•
•
Join Date: Aug 2008
Posts: 4
Reputation:
Solved Threads: 0
•
•
•
•
Regex is a Class that used for Regular Expressions. It is useful for Parsing.
For more detail, refer http://www.regular-expressions.info/dotnet.html
Incorrect, trim does replace line breaks and spaces. Please prove me wrong but you won't.
I have just tested it:
I have just tested it:
VB.NET Syntax (Toggle Plain Text)
Dim nl As String = System.Environment.NewLine Dim test As String = " " + nl + nl + " TheText " + nl + nl TextBox1.Text = test 'show original string in a multiline text box TextBox2.Text = test.Trim 'show changed string in a multiline text box
Last edited by iamthwee; Aug 26th, 2008 at 10:22 am.
*Voted best profile in the world*
•
•
•
•
thanks, how would I pick up on the line breaks and spaces, would it be possile to show me an example?
Please google it for parsing HTML using Regex class. You will get a lot. Once you can able to parse HTML Tags, Ultimately you have to Use String.Trim() to remove unwanted white spaces .
KSG
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: Unable to create an excel file in VB.net
- Next Thread: 2 Questions from a student
| Thread Tools | Search this Thread |
.net .net2008 30minutes 2005 2008 access account arithmetic array basic beginner browser button buttons center check code component connectionstring crystalreport cuesent data database databasesearch datagrid datagridview date datetimepicker design designer dissertation dissertations dissertationtopic dropdownlist excel fade file-dialog filter folder forms ftp generatetags hardcopy html images input insert intel monitor net networking open output panel passingparameters peertopeervideostreaming picturebox picturebox1 port printing problem problemwithinstallation project reports" searchvb.net select serial settings shutdown sqlserver survey tcp temperature text textbox timespan toolbox transparency trim updown user usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio.net visualstudio2008 web winforms wpf wrapingcode year






