Skip to content

Instantly share code, notes, and snippets.

@Deepwalker
Created January 18, 2012 12:52
Show Gist options
  • Save Deepwalker/1632864 to your computer and use it in GitHub Desktop.
Save Deepwalker/1632864 to your computer and use it in GitHub Desktop.
CONTACT = c.Or(
c.String(regex=r'(?P<first_name>^\S+)\s*(?P<last_name>.*\S)\s*<(?P<email>.+@.+.[^.]+)>') >>
(lambda match: match.groupdict()),
c.String(regex=r'(?P<email>.+@.+..+)') >>
(lambda match: {'first_name': 'none', 'second_name': 'none', 'email': match.group()})
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment