I am looking for a way to remove the first occurrence of a comma in a string, for example
\"some text1, some tex2, some text3\"
should retu
This will do it:
if (str.match(/,.*,/)) { // Check if there are 2 commas str = str.replace(',', ''); // Remove the first one }
When you use the replace method with a string rather than an RE, it just replaces the first match.
replace