使用 RegEx 提取 Office 365 电子邮件 UPN 格式

Using RegEx to extract Office 365 email UPN formatted

我在 Nintex 操作中使用 .NET 正则表达式语法,并想提取电子邮件,如下所示

i:0#.f|会员资格|daniel.Smith@domain.onmicrosoft.com

现在我认为方法是匹配 i:0#.f|membership 位但排除它然后匹配其余部分。我将不胜感激任何帮助。我确实尝试了这个表达式,它确实与上面的一些相匹配。

(?<=)(i:0#.f|membership).

丹尼尔

如果您打算在 Nintex 中使用提取模式,您可以使用

[^|]+$

匹配字符串末尾 | 以外的 1 个或多个字符。 [^...] 称为 negated character class,其中包含不匹配的文字符号或范围,其他所有内容都匹配:

The result is that the [negated] character class matches any character that is not in the character class.

regex demo

或者,您可以使用

的替换操作
^.*\|

并替换为空文本。参见 this demo

这里的要点是,我们首先匹配字符串开始,然后使用贪婪点(.*)回溯到最后一个文字|,并删除整个匹配。