softwarelabus — 2011-03-14T14:01:42-04:00 — #1
Code example to search for html <div> tag:
index = html.search(/<div>|<div .*>/i);
As you can see it also searches for anything inside the div tag; e.g., <div style="color:#00FF00">
Any recommendations how to find the length of the search result? For example <div> is 5 characters, while <div style="color:#00FF00"> is 27 characters.
The only way I know how to do it is with two searches. The above search, then search for the ending > character to get the length.
samanime — 2011-03-14T16:10:47-04:00 — #2
I'm not quite sure I get the problem.
What is the end-result you are trying to achieve with this?
softwarelabus — 2011-03-14T16:24:47-04:00 — #3
It's for a html tidy function I'm writing for a WYSIWYG.
samanime — 2011-03-14T19:58:39-04:00 — #4
What's this portion of the function supposed to do? When I write them I generally just kill whitespace in between elements with a simple regex. Can you elaborate a bit more?