Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching a string

Status
Not open for further replies.

tektipster79

Programmer
Oct 1, 2007
34
US
I'm looking for a way to search a string for a specific div, so that I can remove it. The div does have an id so it should be easy to find the start index, but I'm not sure how to indicate that the end index should be "</div>". How can I accomplish this?
 
You could potentially count the number of "<div>"s you find after the start index and ignore that number of "</div>"s. So after your start index, you find 3 more "<div>"...you then know that the 4th "</div>" is the one you're after.

...maybe?
 
I was thinking along the lines of a regex too, but I'm not sure what the regex would be.
 
there are examples on line on how to stripout HTML tags and their content.
 
you could use a tool like Watin to parse the dom.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top