fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String softParms = "batch_code => 'batchCd',user_id => 'SYSUSER',thread_pool => 'tpName',business_date => FN_DATE_ARG(null,0),rerun_number => 0,max_timeout_mins => 0,raise_error => false,thread_notifications => false";
  11. Pattern paramPattern = Pattern.compile("([^\\s,]+)\\s*=>\\s*(.*?)(?=\\s*,\\s*\\w+\\s*=>|$)");
  12. Matcher matcher = paramPattern.matcher(softParms);
  13. while (matcher.find()) {
  14. String param = matcher.group(1);
  15. String value = matcher.group(2);
  16. System.out.println("Param: " + param + ", Value: " + value);
  17. }
  18. }
  19. }
Success #stdin #stdout 0.24s 36868KB
stdin
Standard input is empty
stdout
Param: batch_code, Value: 'batchCd'
Param: user_id, Value: 'SYSUSER'
Param: thread_pool, Value: 'tpName'
Param: business_date, Value: FN_DATE_ARG(null,0)
Param: rerun_number, Value: 0
Param: max_timeout_mins, Value: 0
Param: raise_error, Value: false
Param: thread_notifications, Value: false