Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to find last occurrence comma in a string and replace with value in javascript

var str = 'a_b_c',
    replacement = '!';

console.log(  str.replace(/_([^_]*)$/, replacement + '$1')  ) //a_b!c
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #find #occurrence #comma #string #replace #javascript
ADD COMMENT
Topic
Name
6+8 =