+ return getQuery(cpsPathQuery, sqlStringBuilder, queryParameters);
+ }
+
+ /**
+ * Create a regular expression (string) for matching xpaths based on the given cps path query.
+ *
+ * @param cpsPathQuery the cps path query to determine the required regular expression
+ * @return a string representing the required regular expression
+ */
+ public static String getXpathSqlRegex(final CpsPathQuery cpsPathQuery) {
+ final StringBuilder xpathRegexBuilder = getRegexStringBuilderWithPrefix(cpsPathQuery);
+ xpathRegexBuilder.append(REGEX_OPTIONAL_LIST_INDEX_POSTFIX);
+ return xpathRegexBuilder.toString();
+ }
+
+ /**
+ * Create a regular expression (string) for matching xpaths with (all) descendants
+ * based on the given cps path query.
+ *
+ * @param cpsPathQuery the cps path query to determine the required regular expression
+ * @return a string representing the required regular expression
+ */
+ public static String getXpathSqlRegexForQuickFindWithDescendants(final CpsPathQuery cpsPathQuery) {
+ final StringBuilder xpathRegexBuilder = getRegexStringBuilderWithPrefix(cpsPathQuery);
+ xpathRegexBuilder.append(REGEX_FOR_QUICK_FIND_WITH_DESCENDANTS);
+ return xpathRegexBuilder.toString();
+ }
+
+ private Query getQuery(final CpsPathQuery cpsPathQuery, final StringBuilder sqlStringBuilder,
+ final Map<String, Object> queryParameters) {
+ final String xpathRegex = getXpathSqlRegex(cpsPathQuery);