Regex to get middle initial or the only letter

Get the middle initial after a name using regex , the patter would be the last single letter from a string ? . Thanks for any idea.

Example Input :
Scott M


Example Input :
Scott Markcus J
Output : J

Please find the below regex:


1 Like

Split with " " and fetch the last item in the array.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.