Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

PowerTip: How to use regular expressions to split a string without losing the character you split on

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how to split a string without losing the character you split on. (image) I’m splitting this file name some file.txt into its name and extension by going “some file.txt” –split “.”. It’s giving me some file and txt, but I want to keep the dot and get .txt instead...

PowerTip: How to detect a valid Active Directory user name using regular expressions

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how use regex to detect if a string is a valid Active Directory user name. (image) The invalid characters for an Active Directory user name are and . How do I tell if a string is a valid Active Directory user name?   (image) You can treat this array of characters as a...