org.apache.stanbol.entityhub.servicesapi.util
Class PatternUtils

java.lang.Object
  extended by org.apache.stanbol.entityhub.servicesapi.util.PatternUtils

public final class PatternUtils
extends java.lang.Object


Field Summary
static java.util.regex.Pattern PREFIX_REGEX_PATTERN
           
 
Method Summary
static java.lang.String escapeRegex(java.lang.String wildcard)
           
static boolean usesWildCard(java.lang.String value)
          Returns true if the parsed value contains an '?' or '*'
static java.lang.String value2Regex(java.lang.String value)
           
static java.lang.String wildcardToRegex(java.lang.String wildcard, boolean strict)
          Converts a Wildcard search string to REGEX.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX_REGEX_PATTERN

public static final java.util.regex.Pattern PREFIX_REGEX_PATTERN
Method Detail

wildcardToRegex

public static java.lang.String wildcardToRegex(java.lang.String wildcard,
                                               boolean strict)
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.*")

Parameters:
wildcard - the wildcard pattern
strict - if true than the REGEX pattern searches whole words.
Returns:
the pattern

value2Regex

public static java.lang.String value2Regex(java.lang.String value)

escapeRegex

public static java.lang.String escapeRegex(java.lang.String wildcard)

usesWildCard

public static boolean usesWildCard(java.lang.String value)
Returns true if the parsed value contains an '?' or '*'

Parameters:
value - the value to check
Returns:
true if the parsed value contains an '?' or '*'


Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.