在鍵值對解析字符串表達式我有這樣的字符串:經常在Java
"{ '_id' : ObjectId('4e85ba250364e5a1857ba2e4'),
'message' : '<[email protected]>, <action=create-flock>,
params=[<title=[[email protected], [email protected]],
attendees=immediate, flockType=immediate, duration=30]>' }";
我嘗試以下的正則表達式就可以了:
private static String REGEXFinal = "<(.*?)>";
private static String REGEX2Final = "<(.*)>";
施加上述兩個正則表達式最終出來後是
[email protected]
action=create-flock
title=[[email protected], [email protected]], attendees=immediate, flockType=immediate, duration=30]
但我想在鍵/值格式的O/P像
user [email protected]
action create-flock
title [[email protected], [email protected]], attendees=immediate, flockType=immediate, duration=30]
該怎麼做?
你控制字符串?如果是這樣,您可以將整個字符串轉換爲json,並使用json解析器。 – dacwe