C
carlbernardi
HI,
I am new to java.util.regex package which I am using to detect each
time the javascript tag occurs in an html file and delete it. I tried
using the following code to find examples such as the ones below but
instead it finds the first occurrence of "<" and the last occurrence
of ">" which is not what I am looking for.
<script>
<script src="script.js">
</script>
String mat = "<html><script><p><font></script>";
String pat = "<*[\\x00-\\x7f]*jscript*[a-z0-9]*>";
Pattern pattern = Pattern.compile(pat);
Matcher matcher = pattern.matcher(mat);
while(matcher.find()){
System.out.println("Match: "+matcher.group()+"
Start:"+matcher.start()+" End:"+ matcher.end());
}
output:
Match: <html><script><p><font><script> Start:0 End:39
i would be looking for an out put of:
Match: <script> Start:6 End:18
Match: <script> Start:27 End:18
Appreciate any input,
Carl
I am new to java.util.regex package which I am using to detect each
time the javascript tag occurs in an html file and delete it. I tried
using the following code to find examples such as the ones below but
instead it finds the first occurrence of "<" and the last occurrence
of ">" which is not what I am looking for.
<script>
<script src="script.js">
</script>
String mat = "<html><script><p><font></script>";
String pat = "<*[\\x00-\\x7f]*jscript*[a-z0-9]*>";
Pattern pattern = Pattern.compile(pat);
Matcher matcher = pattern.matcher(mat);
while(matcher.find()){
System.out.println("Match: "+matcher.group()+"
Start:"+matcher.start()+" End:"+ matcher.end());
}
output:
Match: <html><script><p><font><script> Start:0 End:39
i would be looking for an out put of:
Match: <script> Start:6 End:18
Match: <script> Start:27 End:18
Appreciate any input,
Carl