public final class RegexMatchers extends Object
Modifier and Type | Method and Description |
---|---|
static Matcher<String> |
containsAllPatterns(String... patterns)
Checks whether a
String contains a subsequence matching any of
the given regular expressions. |
static Matcher<String> |
containsAnyPattern(String... patterns)
Checks whether a
String contains a subsequence matching any of
the given regular expressions. |
static Matcher<String> |
containsPattern(String pattern)
Checks whether a String contains a subsequence matching the given regular
expression.
|
static Matcher<String> |
matchesAnyPattern(String... patterns)
Checks whether a String matches at lease one of given regular
expressions.
|
static Matcher<String> |
matchesPattern(String pattern)
Checks whether a String matches the given regular expression.
|
public static Matcher<String> matchesAnyPattern(String... patterns)
patterns
- Regular expression patternspublic static Matcher<String> matchesPattern(String pattern)
String.matches(String)
. For example:
MatcherAssert.assert( "abc123", RegexMatchers.matchesPattern("[a-c]+\\d{3}") );
pattern
- The pattern to match againstpublic static Matcher<String> containsPattern(String pattern)
Matcher.find()
. For example:
MatcherAssert.assert( "fooBar123", RegexMatchers.containsPattern("Bar12") );
pattern
- The pattern to match againstpublic static Matcher<String> containsAnyPattern(String... patterns)
String
contains a subsequence matching any of
the given regular expressions.patterns
- The patterns to match againstMatcher.find()
,
containsPattern(String)
public static Matcher<String> containsAllPatterns(String... patterns)
String
contains a subsequence matching any of
the given regular expressions.patterns
- The patterns to match againstMatcher.find()
,
containsPattern(String)
Copyright © 2012–2017 jcabi.com. All rights reserved.