Title |
Test
Find
Pattern Title
|
Expression |
<script[^>]*>[\w|\t|\r|\W]*</script> |
Description |
this pattern can find all lines of script in HTML code from open to close tag range |
Matches |
<script language=javascript>document.write("one");</script> |
Non-Matches |
-- |
Author |
Rating:
Bassel Issa
|
Source |
|
Your Rating |
|
Title: Use this to scripts exactly.
Name: Advice
Date: 10/31/2008 10:47:11 AM
Comment:
Regex:
<script[^>]*>[\w|\t|\r|\W]*?</script>
Input:
<script>[\w|\t|\r|\W]*</script>
Not to be matched...
<script>[\w|\t|\r|\W]*</script>
Title: my fix
Name: Norb
Date: 9/2/2008 1:09:28 PM
Comment:
this is what i used to get a better result with this
\<script[^>]*>[\w|\t|\r|\W]*?\<\/script\>
Title: I should follow up
Name: Dave S
Date: 12/22/2004 2:56:16 PM
Comment:
Note: I suppose I should explain my previous post more...
I began using the original expressino from Bassel:
<script[^>]*>[\w|\t|\r|\W]*</script>
But then changed in favour of Dave Rossow's solution (to workaround multiple occurances:
<script[^>]*>(.(?!<script))*</script>
but i noticed that his solution doesn't match any occurances of a "<script>" tag with whitespace like this: < script>
also doesn't match:
</script >
So, in my previous post, i've made a modification to Dave Rossow's earlier expression. It apperas to be working for me, but I wonder if there's a better method than:
script[^>]*>(.(?!<*script))*/script
Cheers.
Title: Whitespace inside < script > tags
Name: Dave
Date: 12/22/2004 2:51:23 PM
Comment:
< script > < /script >
How could this expression be modified to match script tags if there is whitespace?
perhaps:
script[^>]*>(.(?!<*script))*/script
Cheers.
?
Title: requires to be changed for being..end
Name: V.C.Sekhar
Date: 10/16/2004 12:44:36 AM
Comment:
Hi Atticus,
Please advise on how to change this expression if I should not use
^begin([\w|\t|\r|\W]*?)end$
to capture anything between the words "begin" and "end" (like in T-SQL).
Thanks in advance,
Sekhar
Title: This is my title
Name: Atticus
Date: 2/13/2004 3:25:36 PM
Comment:
Woo! I was just looking for something like this. Here's another way to solve the multiple occurances problem...
<tag>([\w|\t|\r|\W]*?)<\/tag>
Title: Multiple Occurrences Solution
Name: Dave Rossow
Date: 2/2/2004 8:15:43 PM
Comment:
The solution below solves the problem of multiple occurrences.
<script[^>]*>(.(?!<script))*</script>
Title: sorry for the spam
Name: Ben Hoskins
Date: 6/10/2003 8:42:38 AM
Comment:
just quickly fixed this expression - it should be:
<script[^>]*>[\w|\t|\r|\W]*?</script>
Title: Bug Problem
Name: Ben Hoskins
Date: 6/10/2003 8:21:23 AM
Comment:
I'm using this regex for replacing script - the only problem is that if there's two or more script tags on a page it'll grab all in between...
i.e.
the page is:
<html><head><script>somescript</script></head><body><script>somemorescript</script></body></html>
say i do a replace on this string in vb.net - it'll do this:
<html><head><script>somedifferentscript</script></body></html>
anyone any suggestions?
Title: News Spider Product Developer
Name: Mike Martinez
Date: 3/24/2003 4:45:25 PM
Comment:
How do you handle /script in C#? With escape character and all???