I have managed to get myself into a confused haze trying to figure out a specific regex for Powershell.
I have a csv file that I am going to import into Active Directory, however the Phone number is just an extension and I need to prepend the beginning of the number.
Simple enough until I realise that if the extension starts with a 3 it is one number, but if it is a 6 it is another number.
Here is what I have got so far:
$Tel1 = “+44 1481 705” #Ext begins with a 3
$Tel2 = “+44 1481 731” #Ext begins with a 6
So do you want to strip the 3 or 6 from the beginning of the extension and replace it with “+44 1481 7”? (I’m a little confused exactly what you’re trying to replace.) If so, you can do this: