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

public class Test {

static String teststr = "UAPPROJECT_ID='402894cb4833decf014833e04fd70002 ; \n\r */' select ";

/**
* 包含回车换行符的处理
*/
public static void testa(){
Pattern wp = Pattern.compile("'.*?'", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
Matcher m = wp.matcher(teststr);
String result = m.replaceAll("");
System.out.println("result:" + result);
}

/**
* 包含回车换行符的处理
*/
public static void testb(){
String result = teststr.replaceAll("(?s)'.*?'", "");
System.out.println("result:" + result);
}

public static void testc() {
String a = "abc \r\n您的查询码为:20160302175452496865,请妥善保存!\r\n def";
String b = a.replaceAll("(?s).*您的查询码为:", "").replaceAll("(?s),请妥善保存!.*", "");
System.out.println("result:" + b);
}

public static void main(String[] args) {
testa();
testb();
testc();
}
}

最新文章

  1. 简单测试flume+kafka+storm的集成
  2. PNG使用技巧 PNG的使用技巧
  3. centos linux安装telnet 过程及问题(源于内部tomcat网站,外部无法访问)
  4. sql server 2008 跨服务器查询
  5. 最长公共子序列 LCS
  6. Apache Commons 常用工具类整理
  7. 【bzoj1061】 Noi2008—志愿者招募
  8. 包含Blob字段的表无法Export/Import
  9. Linux SCP 命令: 利用SSH传输文件
  10. oracle学习----trace文件
  11. 【动态规划】XMU 1583 Sequence
  12. Nginx源码研究一:NGINX模块启动
  13. 安装nginx+ngx_lua支持WAF防护功能
  14. 刚开始学python——数据结构——“自定义队列结构“
  15. VueRouter和Vue生命周期(钩子函数)
  16. web前端学习python之第一章_基础语法(一)
  17. 云笔记项目-Spring事务学习-传播MANDATORY
  18. redis-dump安装与导出redis数据
  19. python常用库函数 - 备忘
  20. SQL Server 性能优化实战系列(二)

热门文章

  1. openssl交叉编译记录
  2. ansible-role写法
  3. openssl windows 生成公钥与私钥
  4. Android学习之触点事件的处理
  5. SpringMVC异常处理方式
  6. php利用自定义key,对数据加解密的方法
  7. Identity(五)
  8. Yarn 入门
  9. C# webApi上传图片 代码篇
  10. Luogu P2403 [SDOI2010]所驼门王的宝藏