const regex = /^\s/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^\\s', 'gm')
const str = `
Description=Qualcomm Atheros AR8161 PCI-E Gigabit Ethernet Controller (NDIS 6.30)
MACAddress=FF:FF:FF:FF:FF:FF
Manufacturer=Qualcomm Atheros
NetConnectionID=Ethernet
Description=Realtek RTL8811AU Wireless LAN 802.11ac USB 2.0 Network Adapter
MACAddress=FF:FF:FF:FF:FF:FF
Manufacturer=Realtek Semiconductor Corp.
NetConnectionID=Wi-Fi
Description=VirtualBox Host-Only Ethernet Adapter
MACAddress=FF:FF:FF:FF:FF:FF
Manufacturer=Oracle Corporation
NetConnectionID=VirtualBox Host-Only Network
Description=Bluetooth Device (Personal Area Network)
MACAddress=FF:FF:FF:FF:FF:FF
Manufacturer=Microsoft
NetConnectionID=Connexion réseau Bluetooth 2
`;
const subst = ``;
// 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