NSRegularExpression

public extension NSRegularExpression

The NSRegularExpression extension

  • Initializer to initialize regular expression with some pattern

    Declaration

    Swift

    convenience init(_ pattern: String)

    Parameters

    pattern

    regular expression pattern

  • checks if the String matches the regular expression or not

    Declaration

    Swift

    func matches(_ string: String) -> Bool

    Parameters

    string

    String to be matched

    Return Value

    true if String matches the pattern else returns false