Here is my code to look for adjacent words around a proper noun. I get an error for this code mentioned below. I've tried adding different permutations and combinations of backslashes and closing brackets but still get the error. Will appreciate help.
for (String properNoun : properNouns){
Pattern pattern = Pattern.compile("([^\\s]+\\s+[^\\s]+)\\s+"+properNoun+"\\s+([^\\s]+\\s+[^\\s]+)\\s+");
Matcher matcher = pattern.matcher(sentence);
while (matcher.find()){
................
The error I get is:
Exception in thread "main" java.util.regex.PatternSyntaxException:
Unclosed character class near index 44
([^\s]+\s+[^\s]+)\s+[]\s+([^\s]+\s+[^\s]+)\s+
Sentence - Cyprium Mining is pleased to announce that at a special meeting of debenture holders held on September 21 , 2016 ( the " Meeting " ) the holders of dollars 750,000 in principal_amount of unsecured debentures bearing interest at 12 % per_annum ( the " Debentures " ) overwhelmingly approved all matters presented , including the extension of the maturity_date from February 28 , 2017 to February 28 , 2019 .
properNouns - [[], [Cyprium], [February], [the Debentures], [September]]