Module Name: Contact Name Unmangler
Module path: recon/contacts-contacts/unmangle


OVERWRITE:
PATTERN:
SOURCE:


Name: Contact Name Unmangler
Path: modules/recon/contacts-contacts/unmangle.py
Author: Ethan Robish (@EthanRobish)

Description:
Applies a regex or unmangle pattern to all of the contacts stored in the database, pulling out the individual name components. Updates the 'contacts' table with the results.

Options:
Name Current Value Required Description
OVERWRITE False yes if set to true will update existing contact entry, otherwise it will create a new entry
PATTERN False <fn>.<ln> pattern applied to email
SOURCE default yes source of input (see 'show info' for details)

Source Options:
default SELECT rowid, first_name, middle_name, last_name, email FROM contacts WHERE email IS NOT NULL
<string> string representing a single input
<path> path to a file containing a list of inputs
query <sql> database query returning one column of inputs

Comments:
* Pattern can be either a regex or a pattern.
* The available patterns are:
    - <fn>.<ln>, <fn>, <fi><ln>, <fn>-<ln>, <ln>, <fn>_<ln>, <ln><fi><mi>, <ln><fi>
* A regex must capture the values using these named capture groups:
    - (?P<first_name>) (?P<middle_name>) (?P<last_name>)
* A regex syntax cheatsheet and troubleshooter can be found here:
    - http://pythex.org/ or http://www.pyregex.com/