Use regex to replace numbers with manipulated number - Javascript RegExp

Javascript examples for RegExp:Match Number

Description

Use regex to replace numbers with manipulated number

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width"> 
   </head> 
   <body> 
      <script>
var s = "4/7/12";
var n = s.split('/').map(function(el) {
  return 25 - Number(el);// w ww  . ja  va  2  s .com
}).join('/');
console.log(n);

      </script>  
   </body>
</html>

Related Tutorials