Length of search result
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.
I'm not quite sure I get the problem.
What is the end-result you are trying to achieve with this?
It's for a html tidy function I'm writing for a WYSIWYG.
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?