String pattern matching, what is the result of executing the following code? And the reasons.

related codes

var colorText = "red,blue,green,yellow";
colorText.split(/[^\,]+/);
// ["", ",", ",", ",", ""]
Jul.06,2022

regularly matches non-comma content. Split uses the matching content as a knife to cut the string into two halves


there is actually an empty string before red. Similarly, there is an empty string
after yellow, and your regular character is separated by characters other than comma [1,], so three commas plus two empty strings

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e5f7-4daa7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e5f7-4daa7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?