Home » Javascript » javascript – How can I split a string by comma with a particular pattern?

javascript – How can I split a string by comma with a particular pattern?

Posted by: admin February 24, 2020 Leave a comment

Questions:

I have this string

Putonghua,Female,bye,"abc,cde",hello

And I would like to separate them by comma and
hope to receive

['Putonghua', 'Female', 'bye', '"abc,cde"', 'hello]

How can i do that?

How to&Answers: