package com.ekkcole.controlle;public class Test {public static void main(String[] args) {String word = getWordAll("东青社区居委会(含东青村村委)");String word1 = getWordAll("东青社区居委会(含东青村村委)");System.out.println("word1 = " + word1);System.out.println("word = " + word);}/*** 排除中/英文括号及括号内的数据* @param content* @return*/public static String getWordAll(String content){if(content.contains("(") || content.contains(")")){// 去除英文括号及内容content=content.replaceAll("[\\[][^\\[\\]]+[\\]]|[\\(][^\\(\\)]+[\\)]", "");}if(content.contains("(") || content.contains(")")){// 去除中文括号及内容content=content.replaceAll("[\\[][^\\[\\]]+[\\]]|[\\()][^\\(\\)]+[\\)]", "");}return content;}}