FWRegex

enum FWRegex : String

Collection of default Regular Expressions strings.

  • Matches E-mail strings i.e. example@example.org.

    Regex rule: ‘[0-9a-z._%+-]+@[a-z0-9.-]+.[a-z]{2,64}’

    Declaration

    Swift

    case email = "[0-9a-z._%+-]+@[a-z0-9.-]+\\.[a-z]{2,64}"
  • Matches Brazilian phone numbers with DDD (landline and mobile) strings

    Regex rule: ‘(?\b([0-9]{2,3}|0((x|[0-9]){2,3}[0-9]{2})))?\s*[0-9]{4,5}[- ]*[0-9]{4}\b’.

    Phone Formats

    - 0012345678
    - 00123456789
    - 00 1234 1234
    - 00 12345 1234
    - (00)1234-1234
    - (00)12345-1234
    - (00)12345678
    - (00)123456789
    - (00) 1234 1234
    - (00) 12345 1234
    - (00) 12345678
    - (00) 123456789
    - (000)1234 1234
    - (000)12345 1234
    - 0000123456789
    

    Declaration

    Swift

    case phonenumber = "\\(?\\b([0-9]{2,3}|0((x|[0-9]){2,3}[0-9]{2}))\\)?\\s*[0-9]{4,5}[- ]*[0-9]{4}\\b"
  • Matches strings with a maximum of 32 characters.

    Regex rule: ‘[A-Za-z0-9 !\“#$%&’()*+,-./:;<=>?@\[\\]^_`{|}~]{0,32}‘

    Declaration

    Swift

    case max32 = "[A-Za-z0-9 !\"#$%&'()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~]{0,32}"
  • Matches strigns with numerical characters only format.

    Regex rule: ‘[0-9]*’

    Declaration

    Swift

    case numerical = "[0-9]+"
  • Localized string describing the rule for matching this regular expression.

    Declaration

    Swift

    var localizedDescription: String { get }