I need to reformat the value of $ADUser
From: 0123456789
Into: +31 123456789
Without the leading 0 component.
The below snippet is what I have come up with, but it is still not working with the RegEx section to segregate the 0 section.
Code: Select all
$ADUser = '0123456789'
$(If ($ADUser) {
If ($ADUser.ToString() -match '^([\+|0-9 ][ 0-9.]{1,12})$')
{ "+31 $($Matches['^([\+|0-9 ][ 0-9.]{1,12})$'])" }
Else
{ $ADUser.ToString() }
}
Else { $ADUser.ToString() })
Thanks in advance,