const regex = new RegExp('F Blocks:[\\t ]+(0x)?([0-9a-f]+)[ ]+(0x)?([0-9a-f]+)[ ]+(0x)?([0-9a-f]+)', 'gm')
const str = `Entry : 12300000
F Blocks: 00000020 0x00000000 0x000a1b00
S Blocks: 0x00100000 0x0000001c 0x00000150`;
const subst = `0x\2 0x\4 0x\6`;
// The substituted value will be contained in the result variable
const result = str.replace(regex, subst);
console.log('Substitution result: ', result);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions