用. | * \\ [ ]必须是用转义符\\才可以隔开。 type2NameMap.keySet().toString().replaceAll("[\\[\\|\\]]", "") https://www.cnblogs.com/cai170221/p/7098802.html