'Regex to search group name after Active Directory canonical path
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
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Wiktor Stribiżew |
