[Javascript] regexp - how to exclude a substring?

Paul Novitski paul at novitskisoftware.com
Mon May 23 16:09:07 CDT 2005

At 12:48 PM 5/23/2005, Mike Dougherty wrote:
>Have you considered using DOM methods?  if this were client-side work, 
>it'd be straightforward: var loContainedDivs = 
>getElementsByTagName("div")  if (loContainedDivs.length == 0) {something}

I want to do my HTML template processing server-side for a number of 
reasons, among them so I can *guarantee* page generation regardless of 
browser settings.  I briefly considered using server-side Javascript for 
the very reason that it appears to let you manipulate pages through the 
DOM, but that language requires a special interpreter that doesn't appear 
to be very common; I'm writing my app in ASP & PHP so it will run on 
virtually any Unix, Linux, or Windows server.

>Can you instantiate a rendering engine and use its methods to interrogate 
>these html snippets?

Hmm, interesting idea.  I don't know how to do that.  Other than finding 
HTML parsing logic that someone else has written in PHP and/or ASP and 
incorporating it as a library...  For now, I'm having fun writing my own 
code, and what I need to do isn't rocket science.  I'm just looking around 
for ways to improve my algorithms.

By the time I'm finished with my code, it will be sort of like DOM-access 
to an external page server-side.  I don't need to duplicate the whole DOM 
for my purposes and won't go to those lengths.


More information about the Javascript mailing list