Created
August 18, 2009 21:00
-
-
Save ussjoin/169963 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.regex.*; | |
public class Test | |
{ | |
public static void main(String[] args) | |
{ | |
String haystack = "<script>Bad</SCRIPT>Good"; | |
String stripHTMLPattern = "<script.+?</script>"; | |
Pattern pattern = Pattern.compile(stripHTMLPattern, Pattern.CASE_INSENSITIVE); | |
Matcher matcher = pattern.matcher(haystack); | |
String stripped = matcher.replaceAll(" "); | |
System.out.println(stripped); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment