javascript - Finding start and end tags in string using regex -
I am trying to parse an HTML file (non strict one) using javascript
My output should be the same HTML file, but I have any & lt; Script & gt; & Lt; / Script & gt;
The internal contents of the tag need to be processed
I think any & lt; Script / & gt;
will not tag I
is a method processScript (script)
.
I have a very clear idea of how this is using only split ()
, but I wonder if I can improve it using regex ? Parsing the HTML with Regex is not usually the best way to do this.
There are so many reasons that this is a better way, some of them are 1) Javascript is already DOM object support, and it is much easier than Reggae and 2) Open / close Tags matching language (similar to matching feet / brackets / etc) is not a regular language.
Comments
Post a Comment