Skip to content

Instantly share code, notes, and snippets.

@realslacker
Created December 10, 2021 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save realslacker/fb1b112af5879448dac9ac59b9e2b715 to your computer and use it in GitHub Desktop.
Save realslacker/fb1b112af5879448dac9ac59b9e2b715 to your computer and use it in GitHub Desktop.
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