
Regular expression question
I'm trying to match the <script> ... </script> in the following HTML text
using a regular expression:
<script language="vbscr>ipt" for="idDoit" event="onclick">
Dim re, Match, Matches, s, m
Set re = new RegExp
re.Pattern = idPattern.value
re.Global = true
re.IgnoreCase = true
s = idInput.value
m = ""
Set Matches = re.Execute(s)
for each Match in Matches
m = m & Match.Value & vbCrLf
next
idOutput.innerText = m
</script>
and using the pattern:
<.?script.*>[.\s]*
As far as my knowledge of regexps goes, that pattern should match everything
after the first line right up to and including the last line.
However, the pattern actually only matches as follows (starting position is
indicated):
_________________________________________________
0: <script language="vbscr>ipt" for="idDoit" event="onclick">
357: </script>
_________________________________________________
My question is: how can I match opening and closing HTML tags and their
content when spread across lines in a string?
TIA
John O'Connell