使用java从单引号中提取字符串中的特定文本

时间:2018-05-28 07:51:10

标签: java regex

我想从整个查询中提取特定字符串。 这是我的查询

 SELECT * FROM (SELECT t1.id_numeric,t1.id_text FROM t1, ( SELECT t2.id_numeric,t2.test_number FROM t2 GROUP BY t2.column4) selected WHERE t1.id_numeric = t2.test_number AND t1.test_number = selected.test_number AND t1.component_name = selected.component_name AND lims.insert_timestamp = selected.insert_timestamp) as fhr_lims_pinebend WHERE ( ( sampled_date >= '2018-02-17 15:24:59') AND ( sampled_date <= '2018-02-17 15:27:00') ) ORDER BY sampled_date ASC;

从这个查询我只想在部分

下面提取
') AND ( sampled_date <= '

任何人都可以建议我正确的正则表达式来实现这一点。我试过几次,但是我试图删除单引号的问题但是失败了。

1 个答案:

答案 0 :(得分:2)

试试这个

AND\s\(\ssampled_date\s<=\s'

但请参阅正则表达式基础知识,首先只使用此