/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) {
String jsonString = "{\"title\":\"{{string_64|dsm_title}}\",\"code\":\"{{string_16|dsm_code}}\",\"enabled\":true,\"enableAdvanceFilter\":false,\"deleteAfterScheduledTime\":false,\"enableDataStoreLog\":false}";
String patternString = "(?>\\\")(?<key>.*?)(?>\\\":\\\"\\{\\{)(?<value>.*?)(?>\\}\\}\\\")";
Pattern pattern = Pattern.compile(patternString);
Matcher matcher = pattern.matcher(jsonString);
HashMap<String, Object> allMatches = new HashMap<>();
while (matcher.find()) {
allMatches.put(matcher.group("value"), matcher.group("key"));
}
System.out.println(allMatches);
}
}