const regex = /Vol=.*\(([\d,.]+)\).*\(([\d,.]+)\).*\(([\d,.]+)\).*\(([\d,.]+)\).*\(([\d,.]+)\).*\(([\d,.]+)\).*\(([\d,.]+)\).*\(([\d,.]+)\).*(?=,Drift)/;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('Vol=.*\\(([\\d,.]+)\\).*\\(([\\d,.]+)\\).*\\(([\\d,.]+)\\).*\\(([\\d,.]+)\\).*\\(([\\d,.]+)\\).*\\(([\\d,.]+)\\).*\\(([\\d,.]+)\\).*\\(([\\d,.]+)\\).*(?=,Drift)', '')
const str = `"Interest.USD,Vol=[Integrated,(0,0.101),(0.2,0.108),(1,0.110),(2,0.106),(3,0.102),(4,0.09),(5,0.091),(6,0.09128272)],Drift=[Integrated,(0.002,0.09),(0.24,0.0007),(0.4,0.007),(1,-0.033),(2,-0.005),(3,-0.0041),(4,-0.3505),(5,-0.65),(7,-0.08346),(8,-0.049),(9,-0.0613),(10,-0.019)],Risk_Neutral=YES,Lambda=0.09,FX_Volatility=0.01,FX_Correlation=0.9"
`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
if ((m = regex.exec(str)) !== null) {
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
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