Given a string
\'1.2.3.4.5\'
I would like to get this output
\'1.2345\'
(In case there are no dots in the
It would be a lot easier with reg exp if browsers supported look behinds.
One way with a regular expression:
function process( str ) { return str.replace( /^([^.]*\.)(.*)$/, function ( a, b, c ) { return b + c.replace( /\./g, '' ); }); }