需要帮助制作正则表达式来分割一些参数/消息。我得到了这个论点/消息
DynaActionForm[dynaClass=fbDetailInterTransfer,beneficiaryBank=000014,transactionReference=,beneReferenceNo=,terminationDate=,payFrequency=,beneficiaryResident=,amount=10000000,selectedDateTermination=,currencyCode=,selectedMonthTermination=,beneficiaryId=,paymentType=,payFrequencyCode=,fromAccount=0,selectedMonth=,effectiveDateRecurring=,toAccountHolderName=,selectedDate=,payMode=1,selectedYearTermination=,toAccount=3403571268,segment=,remarks=,effectiveDate=,checkBeneficiaryId=,emailAddress=,selectedYear=,beneficiaryIdType=]
我需要拆分该参数/消息才能获得此参数/消息
beneficiaryBank=000014
amount=10000000
toAccount=3403571268
为了获得上述结果,使用什么正则表达式?
答案 0 :(得分:0)
这个正则表达式应该有效 - [a-zA-Z] + = [0-9] + 使它成为一个捕获组([a-zA-Z] + = [0-9] +)。迭代并获得所需的结果。
Pattern prPattern = Pattern.compile("([a-zA-Z]+=[0-9]+)");
Matcher prMatcher = prPattern.matcher(input);
while (prMatcher.find()) {
System.out.println(prMatcher.group(1));
}
<强>输出:强>
beneficiaryBank=000014
amount=10000000
fromAccount=0
payMode=1
toAccount=3403571268