/** * Converts a Wildcard search string to REGEX matching whole words in * the text. * @param wildcard the wildcard pattern * @return the regex pattern for the parsed wildcard * @since 0.12.1 */ public static String wildcardWordToRegex(String wildcard){ StringBuilder regex = new StringBuilder("\\b"); encodeWildcard(wildcard, regex); return regex.append("\\b").toString(); } /**
/** * Converts a Wildcard search string to REGEX matching whole words in * the text. * @param wildcard the wildcard pattern * @return the regex pattern for the parsed wildcard * @since 0.12.1 */ public static String wildcardWordToRegex(String wildcard){ StringBuilder regex = new StringBuilder("\\b"); encodeWildcard(wildcard, regex); return regex.append("\\b").toString(); } /**
/** * Converts a Wildcard search string to REGEX. If strict is enabled, than * the REGEX pattern searches only full labels ("^Patt?er.*$") otherwise * it searches the whole text ("Patt?er.*") * @param wildcard the wildcard pattern * @param strict if <code>true</code> than the REGEX pattern searches * whole words. * @return the pattern */ public static String wildcardToRegex(String wildcard,boolean strict){ StringBuilder regex = new StringBuilder(); if(strict){ regex.append('^'); } encodeWildcard(wildcard, regex); if(strict){ regex.append('$'); } return regex.toString(); }
/** * Converts a Wildcard search string to REGEX. If strict is enabled, than * the REGEX pattern searches only full labels ("^Patt?er.*$") otherwise * it searches the whole text ("Patt?er.*") * @param wildcard the wildcard pattern * @param strict if <code>true</code> than the REGEX pattern searches * whole words. * @return the pattern */ public static String wildcardToRegex(String wildcard,boolean strict){ StringBuilder regex = new StringBuilder(); if(strict){ regex.append('^'); } encodeWildcard(wildcard, regex); if(strict){ regex.append('$'); } return regex.toString(); }