I would like to assign the user names in the text environment entered by the user and split them into elements in the array.
Take the theoretically possible input:
people = "Abby Andrews, Ben \r\nCharlie Connors Daphne D., Ernie E. Engels; Faye\r\n\r\nGary Gomez" array = people.split('??')
How can I create a regex to successfully split the crazy chain as shown above?
Must be shared:
\r , \n , \r\n- comma (
, ) or semicolon ( ; ) - some spaces
It should not be divided:
- period (it may be someone starting)
- one space (there may be a separation of the name and surname)
I tried people.split(/\r\n,;/) people.split(/,;\r\n/) people.split(/\r\n,;/) , people.split(/,;\r\n/) and their combinations, but none gave the result.
source share