Regex to extract all but first and last word from a multi-word string

4.93K viewsProgramming
0

How can I write a regex that will return all but first and last words from a multi-word string ?

For eg:- “William Henry Gates” should return “Henry”

Changed status to publish
0

Here it is:-
 /\s+\w+(?: \w+)*\s+/g

Answered question
You are viewing 1 out of 1 answers, click here to view all answers.
Write your answer.

Categories