Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var value = "%4.5667.444...";
// Simple version
var i = 0;
console.log( value.replace(/[\.\%]/g, function(match) { 
  return match === "." ? (i++ === 0 ? '.' : '') : ''; 
}) );
// Self-contained version
console.log( 
  value.replace(/[\.\%]/g, function(match, offset, all) { 
     return match === "." ? (all.indexOf(".") === offset ? '.' : '') : ''; 
  }) 
);
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
Sarubepro
0viewers