Skip to content

Instantly share code, notes, and snippets.

@realslacker
Created December 10, 2021 20:37
Embed
What would you like to do?
Useful Regular Expressions
# Relative OU Path
$RelativeOU = '^(?:(?:CN|OU)=(?:(?<=\\),|[^,])+(?:,(?=(?:CN|OU)=(?:(?<=\\),|[^,])+)|$))+$'
# Full OU
$OU = '^(?:(?:CN|OU)=(?:(?<=\\),|[^,])+,)+(?:DC=(?:(?<=\\),|[^,])+(?:,(?=DC=(?:(?<=\\),|[^,])+)|$))+$'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment