src/main/java/org/helm/notation2/parser/StateMachineParser.java
public boolean checkDetailsConnections(String d) {
    LOG.debug("Validation of connection's details:");
    String group = "\\((\\D|\\d)((,|\\+)(\\D|\\d))+\\)";
    String partOne = "([1-9][0-9]*|\\D|\\?|" + group + ")";
    String partTwo = "(R[1-9][0-9]*+|\\?)";
    String element = partOne + ":" + partTwo;
    String patternConnection = element + "-" + element;
    String hydrogenBondPartner = partOne + ":pair";
    String hydrogenBondPattern = hydrogenBondPartner + "-" + hydrogenBondPartner;
    Pattern pConnection = Pattern.compile(patternConnection , Pattern.CASE_INSENSITIVE);
    Matcher mConnection = pConnection.matcher(d);
    Pattern pHydrogen = Pattern.compile(hydrogenBondPattern, Pattern.CASE_INSENSITIVE);
    Matcher mHydrogen = pHydrogen.matcher(d);
    if (mConnection.matches() || mHydrogen.matches()) {
      LOG.debug("Connection's details are valid:");
      return true;
    }
    LOG.debug("Connection's details are not valid: " + d);
    return false;
  }
public boolean checkDetailsConnections(String d) {
    LOG.debug("Validation of connection's details:");
    String group = "\\((\\D|\\d)((,|\\+)(\\D|\\d))+\\)";
    String partOne = "([1-9][0-9]*|\\D|\\?|" + group + ")";
    String partTwo = "(R[1-9][0-9]*+|\\?)";
    String element = partOne + ":" + partTwo;
    String patternConnection = element + "-" + element;
    String hydrogenBondPartner = partOne + ":pair";
    String hydrogenBondPattern = hydrogenBondPartner + "-" + hydrogenBondPartner;
    Pattern pConnection = Pattern.compile(patternConnection , Pattern.CASE_INSENSITIVE);
    Matcher mConnection = pConnection.matcher(d);
    Pattern pHydrogen = Pattern.compile(hydrogenBondPattern, Pattern.CASE_INSENSITIVE);
    Matcher mHydrogen = pHydrogen.matcher(d);
    if (mConnection.matches() || mHydrogen.matches()) {
      LOG.debug("Connection's details are valid:");
      return true;
    }
    LOG.debug("Connection's details are not valid: " + d);
    return false;
  }
method to validate the details about the connections; hydrogen bonds are
here included

@param d connection details
@return true if the connection details are valid, false otherwise