Package cn.sliew.milky.common.regex
Class Regex
- java.lang.Object
-
- cn.sliew.milky.common.regex.Regex
-
public final class Regex extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleansimpleMatch(String pattern, String str)Match a String against the given pattern, supporting the following simple pattern styles: "xxx*", "*xxx", "*xxx*" and "xxx*yyy" matches (with an arbitrary number of pattern parts), as well as direct equality.static booleansimpleMatch(String pattern, String str, boolean caseInsensitive)Match a String against the given pattern, supporting the following simple pattern styles: "xxx*", "*xxx", "*xxx*" and "xxx*yyy" matches (with an arbitrary number of pattern parts), as well as direct equality.
-
-
-
Method Detail
-
simpleMatch
public static boolean simpleMatch(String pattern, String str)
Match a String against the given pattern, supporting the following simple pattern styles: "xxx*", "*xxx", "*xxx*" and "xxx*yyy" matches (with an arbitrary number of pattern parts), as well as direct equality. Matching is case sensitive.- Parameters:
pattern- the pattern to match againststr- the String to match- Returns:
- whether the String matches the given pattern
-
simpleMatch
public static boolean simpleMatch(String pattern, String str, boolean caseInsensitive)
Match a String against the given pattern, supporting the following simple pattern styles: "xxx*", "*xxx", "*xxx*" and "xxx*yyy" matches (with an arbitrary number of pattern parts), as well as direct equality.- Parameters:
pattern- the pattern to match againststr- the String to matchcaseInsensitive- true if ASCII case differences should be ignored- Returns:
- whether the String matches the given pattern
-
-