Code Snippets

const text = 'Order #1042 for $99.95 placed.';
const re   = /Order #(?<id>\d+) for \$(?<amount>\d+\.\d{2})/;

const m = text.match(re);
if (m) {
  console.log(m.groups.id, m.groups.amount);
}