re = /({"response":{"result":\[)(({"clientId":"(\d{1,})")?,?("clientName":"(\w{1,})")?,?("projectName":"(\w{1,})")?,?("projectId":"(\d{1,})")?,?("jobName":"(\w{1,})")?,?("jobStatus":"([\w-]{1,})")?,?("hours":"([:\d]{1,})")?,?("assignedBy":"([\w.]{1,})")?,?("description":"([\w]{0,})")?,?("isActive":"(true|false{0,})")?,?("fromDate":"([\d-]{0,})")?,?("jobId":"([\d]{0,})")?,?("totalhours":"([\w]{0,})")?,?("ratePerHour":([\d]{1,}))?,?("compsize":([\d]{1,}))?,?("jobcolor":([\d]{1,}))?,?("projectManager":({"erecno":"([\d]{1,})"}))?,?("deleteAllowed":(true|false)}))(],"message":"Data fetched successfully","uri":"\/api\/timetracker\/getjobs","status":0}})/m
str = '{"response":{"result":[{"clientId":"17096000000079988","clientName":"Nuriosan","projectName":"Minecraft","projectId":"17096000000090003","jobName":"PICKAR","jobStatus":"In-Progress","hours":"00:00","assignedBy":"hieu.siah","isActive":"true","fromDate":"2019-10-11","jobId":"17096000000090015","totalhours":"","ratePerHour":0,"compsize":0,"jobcolor":1,"projectManager":{"erecno":"17096000000077005"},"deleteAllowed":false}],"message":"Data fetched successfully","uri":"/api/timetracker/getjobs","status":0}}'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html