Java regex to rewrite date expression -


i have string dates mentioned "or" operator. want rewrite "between" operator. input :

   table.it='2013-03-06-23'  or  table.it='2013-03-07-00'  or   table.it='2013-03-07-01'   or   table.it='2013-03-07-02'   or   table.it='2013-03-07-03'   or   table.it='2013-03-07-04'   or   table.it='2013-03-07-05'   or   table.it='2013-03-07-06'  , table.name = 'test' 

output :

   table.it between '2013-03-06-23' , '2013-03-07-06' , table.name = 'test' 

i want rewrite first , last date between operator. please advice how can in java.

thank you.

hope helps:

string s = "where   table.it='2013-03-06-23'  or  table.it='2013-03-07-00'  or   table.it='2013-03-07-01'   or   table.it='2013-03-07-02'   or   table.it='2013-03-07-03'   or   table.it='2013-03-07-04'   or   table.it='2013-03-07-05'   or   table.it='2013-03-07-06'  , table.name = 'test'"; pattern p = pattern.compile("(\\d{4}-\\d{2}-\\d{2}-\\d{2})"); matcher m = p.matcher(s); m.find(); string first = m.group(1); string last="";   while(m.find()){   last = m.group(1); } s = "where table.it between "+first+" , "+last+" table.name = 'test'"; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -