title: Jmeter beanshell to match and replace
body: <p>I rarely do scripting and I have problem using reg expression using Jmeter's beanshell.
  Basically, I have an output of 16 digits. I wanted to search the string, separate every 2nd character, and prepend with '<strong>0x</strong>' followed by a space, repeat for all 16 digits, lastly using vars.put into a self defined parameters. I have managed to do this in bash easily but not able to find solution with Beanshell Jmeter.</p>
  
  <pre><code>//  get current date
  var d = new Date();
  // convert to epoch
  var militime = d.getTime();
  // convert to 16digit
  //var nowtime1 = (long.valueOf(militime) * 1000);
  var nowtime1 = militime * 1000;
  
  var nowtime1 = nowtime1.replace(/({0,2})/g,"x0"); //I'm unsure of the syntax here
  </code></pre>
  
  <p>Does anyone has suggestion to improve?</p>
  
  <p>This is sample output from my bash script using <em>sed</em> to format:</p>
  
  <pre><code>1495207922508835
  0x14 0x95 0x20 0x79 0x22 0x50 0x88 0x35
  </code></pre>