How to use Regular Expression to find SSN and then replace


i found regular expression in pattern think need social security number.

(?!000)(?!666)^([0-8]\d{2})(\d{2})(\d{4})$

my files not have spaces within numbers or hyphens.

i want find ssn in all. txt document in specific folder , replace them x except last 4 digits on right.  nice tell user how many found , replaced.  (that might bit ask know.)

my folder path here \\shared\e_drive\process\scrub.

can point me in right direction 1)excecute expression , find social sec numbers 2)replace matches xxxx except last 4 numbers. 3) message of completion.   help.

i found couple similar examples via google not same.



here replacement within line:

'this line 23-456-1234 , end' -replace '\d{2}-\d{3}-(\d{4})' ,'xx-xxx-$1'


\_(ツ)_/




Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Motherboard replacement

Cannot create Full Text Search catalog after upgrading to V12 - Database is not fully started up or it is not in an ONLINE state

Remote Desktop App - Error 0x207 or 0x607