67,550
社区成员




String txt = "{{name}}佛顶山{{creatorId}}你好{{ownerId}}allen{{props.mobile}}设计{{props.telphone}}";
Matcher m = Pattern.compile("\\{\\{(.*?)\\}\\}").matcher(txt);
while (m.find()) {
System.out.println(m.group(1));
}
name
creatorId
ownerId
props.mobile
props.telphone
import org.apache.commons.lang.StringUtils;
String testStr = "{{name}}佛顶山{{creatorId}}你好{{ownerId}}allen{{props.mobile}}设计{{props.telphone}}";
String[] arr = StringUtils.substringsBetween(testStr, "{{", "}}");
for (int i = 0; i < arr.length; i++)
{
System.out.println(i + " = " + arr[i]);
}