Regex rewite input string in java -
i have input query string want rewrite below format.
input :
select sum(spend) test time = date_add('2008-12-31', 1) , product_name = 'test123'; rewritten :
select sum(spend) test time = date_add('2008-12-31', interval 1 day) , product_name = 'test123'; i want rewrite "date_add('2008-12-31', 1)" "date_add('2008-12-31', interval 1 day)"
please advice how can in java.
final string query = "select sum(spend) test time = date_add('2008-12-31', 1) , product_name = 'test123'"; final string newquery = query.replaceall("date_add\\((.*),\\s*([0-9]+)\\)", "date_add($1, interval $2 day)");
java regex
No comments:
Post a Comment