我在 Adobe Campaign Classic 9035 中进行了测试。您不能在查询编辑器中使用正则表达式,这是使用拓扑规则强制执行的。我的建议是使用正则表达式来匹配电子邮件地址。
这更像是一个示例,而不是一个确切的答案,因为我们不知道您所说的“有效”是什么意思,您可能希望创建一个“不匹配”的表达式,因为拓扑过滤器会删除与表达式匹配的条目。所以,告诉它你的期望,然后倒置它。
假设您想匹配所有 example.com example.net 和 example.org 地址,您可以使用像 .*@example\.[cno][eor][tmg] 这样的正则表达式(我知道这不是最好的方法,纯粹是为了展示一个例子)。在 PostgresSQL 中,这就像
select semail from nmsrecipients where semail similar to '.*@example\.[cno][eor][tmg]'
对于其他 SQL 检查他们如何做 Regex。然后查找电子邮件域和电子邮件地址验证正则表达式,或者自己制作。您关于“有效”的观点是电子邮件的based on the RFC,通常不是considered to be parsable with a Regex
在 Adobe Campaign 中,您必须做两件事。
- 仔细考虑changing the serverConfig.xml to allow sqlInjection。没有办法阻止常规操作员也使用此功能。所以要非常小心。相反,请跳过此部分并创建自己的函数或使用我的函数。
- 在过滤器中使用 SQL 表达式。点击新建旁边的下拉菜单,然后按
SQL。
然后给它一个适合例如查询的“where”部分的查询
semail similar to E'%@example.\x5Bcno\x5D\x5Beor\x5D\x5Btmg\x5D'
显然,Adobe Campaign 需要您转义方括号。所以请注意\x5B 是[ 而\x5D 是]。
更安全的方法是to make your own function.
我最终为 Postgres 和 ACC 9035 制作了这个正则表达式函数包。只需导入您的环境即可。根据需要进行编辑。
<?xml version="1.0" encoding='ISO-8859-1' ?>
<!-- ===========================================================================
Additional SQL functions for Adobe Campaign
========================================================================== -->
<package
author = "Maeve Kennedy"
namespace = "nms"
name = "regex-functions"
label = "Regex Functions"
buildVersion= "6.7"
buildNumber = "9035">
<entities schema="xtk:funcList">
<funcList name="regex" namespace="cus">
<group name="regex" label="Regex">
<function name="RegexCaseSensitive" type="long" args="(<string>, <pattern>)"
help="Returns 1 if matches anywhere in the string else 0. Use ^ and $ characters to enforce matching whole string"
minArgs="2" maxArgs="2" display="Regular expression matching">
<providerPart provider="PostgreSQL" body="cast($1 ~ $2 as integer)"/>
</function>
<function name="RegexCaseInsensitive" type="long" args="(<string>, <pattern>)"
help="Returns 1 if matches anywhere in the string else 0. Use ^ and $ characters to enforce matching whole string"
minArgs="2" maxArgs="2" display="Regular expression matching">
<providerPart provider="PostgreSQL" body="cast($1 ~* $2 as integer)"/>
</function>
</group>
</funcList>
</entities>
</package>
将“Regex”组添加到表达式编辑器。遵循内置文档。无需转义 [ ]。
注意/免责声明:如果您需要专业帮助,请与我工作的 Munvo 联系。