Skip to content

Adding Identity regex support#1

Open
vagnihotri wants to merge 3 commits intoCleverTap:masterfrom
vagnihotri:master
Open

Adding Identity regex support#1
vagnihotri wants to merge 3 commits intoCleverTap:masterfrom
vagnihotri:master

Conversation

@vagnihotri
Copy link

No description provided.

@vagnihotri
Copy link
Author

Adding support for regexes to validate identities before uploading to CleverTap. This will avoid cases where duplicate profiles are created because the format of the identity field is different, for eg: if someone forgets to add the + sign while using phone numbers as identity. Now, such profiles will be ignored.

The flag where the regex is to be supplied is "identityRegex". Not including the identityRegex flag will not validate the identity field against any regex. The profiles will simply be processed and uploaded.

Sample usage - uploading only those profiles which have identities in the +91XXXXXXXXXX format:
clevertap-data-upload -id="XXX-XXX-XXXX" -p="XXX-XXX-XXXX" -identityRegex="(^[+])91([1-9]){1}([0-9]){9}"

@vagnihotri
Copy link
Author

Updated executables

if(pattern == "") {
return true
}
re := regexp.MustCompile(pattern)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regexp.MustCompile(pattern)
Can this be done once in some global context, so you don't need to compile pattern for every call to isIdentityValid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants