1

What do you think is the best way to determine the closing tag, assuming the script itself has the string inside it.

for example:

<script>
var string="</script";
</script>

If possible without using a stack.

apakian
  • 19
  • 1
  • `var string=" – Pekka Sep 19 '11 at 13:53
  • 1
    Reinventing the wheel? Why not use an existing parser? See http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 – ANeves Sep 19 '11 at 13:53
  • In what language are you writing your parser? And, is this a homework question or do you actually need an HTML parser? – Richard Ev Sep 19 '11 at 14:01
  • If you don't want to use an existing library, you'll almost assuredly need to construct a state machine. Don't try to use regular expressions (see http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags ) – Alex North-Keys Aug 16 '13 at 07:19

0 Answers0