import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class test {

    public static void main(String args[])
    {
        String a="[<<>><<>>]";
        
        String regEx_script="<";    
        String regEx_style= ">";  

         //过滤script标签     
        Pattern p_script=Pattern.compile(regEx_script,Pattern.CASE_INSENSITIVE);    
        Matcher m_script = p_script.matcher(a);
        a = m_script.replaceAll("&lt;");
         
        Pattern p_style = Pattern.compile(regEx_style,Pattern.CASE_INSENSITIVE);     
        Matcher m_style = p_style.matcher(a);      
        a= m_style.replaceAll("&gt;");
        System.out.println(a);
    }
}

 

相关文章:

  • 2021-09-12
  • 2021-08-10
  • 2022-12-23
  • 2021-11-20
  • 2022-01-20
  • 2021-10-29
  • 2021-10-10
猜你喜欢
  • 2021-05-10
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案