RegexPredicate
public struct RegexPredicate : Predicate
The RegexPredicate
struct is used to define regluar expression based conditions used to evaluate input strings.
-
Declaration
Swift
public typealias InputType = String
-
Creates and returns a new
RegexPredicate
instance.Declaration
Swift
public init(expression: String)
Parameters
expression
A
String
describing the regular expression. -
Returns a
Boolean
value that indicates whether a given input matches the regular expression specified by the receiver.Declaration
Swift
public func evaluate(with input: InputType) -> Bool
Parameters
input
The input against which to evaluate the receiver.
Return Value
true
if input matches the reguar expression specified by the receiver, otherwisefalse
.