Re: Checking equal number of <div> and </div> [message #171292 is a reply to message #171283] |
Thu, 30 December 2010 01:28 |
Thomas 'PointedEars'
Messages: 701 Registered: October 2010
Karma:
|
Senior Member |
|
|
jwcarlton wrote:
> Can you guys think of a good way for me to check a string to make sure
> there are an equal number of <div (.*)> and </div>? Then, either add
> or remove </div> tags as needed to make them match?
A recursive RegEx to parse HTML has been posted (by me) and can be easily
found in the manual; whatever is not matched by it can be analyzed further.
However, you should (also) describe the problem you want to solve, not
(only) the problem with your approach for a solution, for the approach might
be completely wrong.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
|
|
|