Hello All,
I would like to know if it is possible to use Recursive Regular Expression Or if there is a regular expression that check for LDAP filter syntax.
To be more specific I am looking for a LDAP filter syntax regex in order to add it as a ValidatePattern Validation Attribute
like this:
Param
(
[parameter(Mandatory=$true)]
[ValidatePattern("(\s*\((?:[&|]\s*RECURSIVE+|(?:!\s*RECURSIVE)|[a-zA-Z][a-zA-Z0-9-]*[~]?=[^()]*)\s*\)\s*)")]
[String[]]
$LDAPFIlter
)
LDAP Syntax Filter
I found this in perl:
/^(\s*((?:[&|]\s*(?1)+|(?:!\s*(?1))|[a-zA-Z][a-zA-Z0-9-][~]?=[^()])\s*)\s*)$/
But it is using recursive pattern (?1)+ . I think it is to get the correct amount of parenthesis.
I see that python as an addition to it that will allow the "recursive " parts.
Thank you in advance for your time.
Ref: