Skip to content

Instantly share code, notes, and snippets.

@malcommac
Created May 20, 2018 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malcommac/59e5bd555139f82809c3f1832fc41836 to your computer and use it in GitHub Desktop.
Save malcommac/59e5bd555139f82809c3f1832fc41836 to your computer and use it in GitHub Desktop.
let emailPattern = "([A-Za-z0-9_\\-\\.\\+])+\\@([A-Za-z0-9_\\-\\.])+\\.([A-Za-z]+)"
let style = StyleRegEx(pattern: emailPattern) {
$0.color = UIColor.red
$0.backColor = UIColor.yellow
}
let str = "My email is hello@danielemargutti.com and my website is http://www.danielemargutti.com".(style: style!)
self.label?.attributedText = str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment