Regex to extract last 4 digit of SSN and other 1 format

If is a valid SSN get the complete SSN if ssn is with ** or not valid then get the last 4 Digit . Thanks.

Current regex: (?<=Your social security number\s?\r?\n?)[\d-]+

Input : Your first name and middle initial Paul R Last name Staff Your social security number 100-80-0769
If joint return, spouse’s first name and middle initial Judasth R Last name Staff Spouse’s social security number 153-46-9152

Output: 100-80-0769

Input : Your first name and middle initial Paul R Last name Staff Your social security number ***-**-0779
If joint return, spouse’s first name and middle initial Judasth R Last name Staff Spouse’s social security number 155-86-9354

Output: 0779

Thanks for any idea.

((?<=Your social security number *{3}-*{2}-)\d{4})|(?<=Your social security number )((\d{3}-\d{2}-\d{4}))


Please refer to the image, there’s some auto-formatting done within the post

can you please share the link ?

would it also posssible to consider SSN without dashes like 100800769 ? thanks,