int nResId = res.getIdentifier(String.format("smiley_%d", nIndex), "drawable", strPackageName);
String.format("smiley_%d", nIndex)
正则表达式:
private static Pattern mPattern = Pattern.compile("\\[([a-zA-Z0-9\\u4e00-\\u9fa5]+?)\\]");
Matcher matcher = mPattern.matcher(strMessage);