Regex to search group name after Active Directory canonical path

334 Views Asked by At

New to regex and not a coder. I am using a group filter in the OKTA SSO application that uses regex for filtering. The below filter works for groups without the full canonical path but it doesn't find groups that are in the format of canonical name. I want to search only for the group name after the path.

  • Example: "(?i)^aws_\S+_(?{{role}}[\w-]+)_(?{{accountid}}\d+)$"
  • will find this: "AWS_Alias_AdministratorAccess_000000"
  • but it will not find this: "llc.domainname.loc/IT/Security Groups/AWS_Alias_AdministratorAccess_12345678"

OKTA Documentation: https://saml-doc.okta.com/SAML_Docs/How-to-Configure-SAML-2.0-for-Amazon-Web-Service.html#setup-step3

1

There are 1 best solutions below

0
Wiktor Stribiżew On

If you mean there must be any one or more chars followed with a / char followed with your pattern you can use

(?i)^.+/aws_\S+_(?{{role}}[\w-]+)_(?{{accountid}}\d+)$

Here,

  • .+ - one or more chars
  • / - a / char.