@Test public void reEscapeNonAlphanumericStrings() throws Exception { assertThat(formatter.unescapedCypherVariable("abc12_A"), is("abc12_A")); assertThat(formatter.unescapedCypherVariable("Åbc12_A"), is("Åbc12_A")); assertThat(formatter.unescapedCypherVariable("`\0`"), is("\0")); assertThat(formatter.unescapedCypherVariable("`\n`"), is("\n")); assertThat(formatter.unescapedCypherVariable("`comma, separated`"), is("comma, separated")); assertThat(formatter.unescapedCypherVariable("`escaped content ``back ticks #`"), is("escaped content `back ticks #")); assertThat(formatter.unescapedCypherVariable("`escaped content two ``back ``ticks`"), is("escaped content two `back `ticks")); }
@Nonnull public static String unescapedCypherVariable(@Nonnull String string) { Matcher alphaNumericMatcher = ALPHA_NUMERIC.matcher(string); if (!alphaNumericMatcher.matches()) { String substring = string.substring(1, string.length() - 1); return substring.replace(BACKTICK + BACKTICK, BACKTICK); } else { return string; } }
CypherVariablesFormatter { @Nonnull public static String unescapedCypherVariable(@Nonnull String string) { Matcher alphaNumericMatcher = ALPHA_NUMERIC.matcher(string); if (!alphaNumericMatcher.matches()) { String substring = string.substring(1, string.length() - 1); return substring.replace(BACKTICK + BACKTICK, BACKTICK); } else { return string; } } }
CypherVariablesFormatter { @Nonnull public static String unescapedCypherVariable(@Nonnull String string) { Matcher alphaNumericMatcher = ALPHA_NUMERIC.matcher(string); if (!alphaNumericMatcher.matches()) { String substring = string.substring(1, string.length() - 1); return substring.replace(BACKTICK + BACKTICK, BACKTICK); } else { return string; } }  }
CypherVariablesFormatter { @Nonnull public static String unescapedCypherVariable(@Nonnull String string) { Matcher alphaNumericMatcher = ALPHA_NUMERIC.matcher(string); if (!alphaNumericMatcher.matches()) { String substring = string.substring(1, string.length() - 1); return substring.replace(BACKTICK + BACKTICK, BACKTICK); } else { return string; } }  @Nonnull static String escape(@Nonnull String string); @Nonnull static String unescapedCypherVariable(@Nonnull String string); }
CypherVariablesFormatter { @Nonnull public static String unescapedCypherVariable(@Nonnull String string) { Matcher alphaNumericMatcher = ALPHA_NUMERIC.matcher(string); if (!alphaNumericMatcher.matches()) { String substring = string.substring(1, string.length() - 1); return substring.replace(BACKTICK + BACKTICK, BACKTICK); } else { return string; } }  @Nonnull static String escape(@Nonnull String string); @Nonnull static String unescapedCypherVariable(@Nonnull String string);  }