- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regex negative lookahead not working
Hi All,
I am trying to use regex to catch some specific email address while excluding some and seems regex negative lookahead is not working in FortiMail. Can anyone confirm that or me just doing it wrong?
My regex is to search in header with line "start with from:" and end with "example.com", but ignore anything from @support.example.com
(?!^from:.*@support\.example\.com$)(^from:.*example\.com$)
Thanks a lot.
Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
brian.li wrote:Try /^from:.*example\.com$/Hi All,
I am trying to use regex to catch some specific email address while excluding some and seems regex negative lookahead is not working in FortiMail. Can anyone confirm that or me just doing it wrong?
My regex is to search in header with line "start with from:" and end with "example.com", but ignore anything from @support.example.com
(?!^from:.*@support\.example\.com$)(^from:.*example\.com$)
Thanks a lot.
Brian
Starts with "from:", ignores an unlimited amount in the middle, ends with "example.com". I escaped the dot in .com so it won't match any character in that space.
** Added: I just saw the second half where you already did that. Sorry not able to add more information. Not sure if Fortimail uses standard regex, but try square brackets instead? And use the pipe between. i.e.
[?!^from:.*@support\.example\.com$|^from:.*example\.com$]
This would equate to not matching on the first half or matching the second half.
Hope that helps.
Bob - self proclaimed posting junkie!
See my Fortigate related scripts at: http://fortigate.camerabob.com
