Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: Tim MeagherHi,
The following BRAINscript regular expression functions are available:
- regexIsMatch
- regexIsMatchI
- regexMatch
- regexMatchI
- regexSubstitute
- regexSubstituteI
These are all documented in the BRAINscript Language help available within BRE. To view the help for these functions, simply go to Help->BRAINscript Help within BRE.
The "Split By Pattern" node is preconfigured to take an input and split the records into two outputs based on whether the specified input Field(s) match the specified regular expression.
I think the attached node has the functionality you want.
I've basically used the regex (with a couple of modifications to not allow leading "." characters and to fit in with the required escaping syntax in BRAINscript) defined here:
http://www.regular-expressions.info/email.html
There are two examples of usage in the attached graph.
The first (top) node uses a Filter node.
Within the filter node, you can use the RegexIsMatchI to perform a case insensitive regex match, so the regex doesn't need to have all lowercase & uppercase combinations.
In addition, since this is a filter node, you can perform other operations within this node if desired (such as renaming output fields, only outputting certain fields etc).
The second (bottom) node uses the Split By Pattern node.
Because the Split By Pattern node is pre-configured, no BRAINscript is required, only the regex & the field to match against.
In this case, however, the regex is treated as case sensitive, therefore the regex pattern must contain all combinations of upper and lower case characters. Also, since the node is used purely for splitting, no additional operations (such as renaming output fields, only outputting certain fields etc) cannot be performed.
Hope this helps.
Tim.
Attachments:
ValidateEmails.brg