Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Regexp Stack Overflow

807580Sep 10 2009 — edited Sep 10 2009
Hey Guys,

I want to remove all script tags from a string containing html sourcecode. Unfortunately the regexp dies.
s = s.replaceAll("<script(\n|\t|\f|\r|.)*</script>", " ");
which results in:
Exception in thread "Thread-14" java.lang.StackOverflowError
	at java.util.regex.Pattern$GroupHead.match(Unknown Source)
	at java.util.regex.Pattern$Loop.match(Unknown Source)
	at java.util.regex.Pattern$GroupTail.match(Unknown Source)
	at java.util.regex.Pattern$BranchConn.match(Unknown Source)
	at java.util.regex.Pattern$CharProperty.match(Unknown Source)
	at java.util.regex.Pattern$Branch.match(Unknown Source)
	at java.util.regex.Pattern$GroupHead.match(Unknown Source)
(inifite loop ...)
Any ideas? Would be nice to have this running soon :-)

Thanks,
Tobi
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 8 2009
Added on Sep 10 2009
15 comments
780 views