I have this string:
CN=Salaried_Emplyees,OU=Migration,OU=Groups
and need a regex to replace everything from the beginning of the string up to the first comma only with whatever I want, ie change to:
CN=Anything,OU=Migration,OU=Groups
However every regex I try ends up matching to the last comma rather than stopping after the first one.
An example of what I've tried:
"CN=Salaried_Emplyees,OU=Migration,OU=Groups" -replace "^CN=.*,", "Anything"
ends up as
AnythingOU=Groups
EDIT:
I'd like to modify this further now by not matching the CN= part so it will only match:
Salaried_Emplyees,
not
CN=Salaried_Emplyees,