java - Filtered out sucess_entries String -
can suggest me string "success entries , failed entries: {failed_entries={}, success_entries={123=1509180522720153332, 124=1509181140480153332}}".
here want filter-out 2 strings 1509180522720153332 , 1509181140480153332.can suggest me ?
you can regex
string str = "success entries , failed entries: {failed_entries={}, success_entries={123=1509180522720153332, 124=1509181140480153332}}"; matcher matcher = pattern.compile("(?<=(success_entries=\\{)).+?(?=\\})").matcher(str); matcher.find(); str = matcher.group(); system.out.println(str); matcher = pattern.compile("(?<=\\d{3}=)\\d+").matcher(str); while(matcher.find()){ system.out.println(matcher.group()); }
but remember regex lookbehind/lookahead not in performance
Comments
Post a Comment