const regex = /(\bbod\S*)|(embodi\S*)/gi;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(\\bbod\\S*)|(embodi\\S*)', 'gi')
const str = `Fancher: what does Eugene teach us about embodiment (for disembodied chatter bot) and intelligence? #RSA16
Faris: And in spite of turns to embodiment and sensation, little on eros of bodies #o15 #rsa16
Kerschbaum: Embodiment and embodied knowledge is always embedded with our decisions and navigations of spaces. #rsa16
#yesallwomen shows digital embodiment through storytelling. #g19 #RSA16 @RCMeg
Virtual is an extension of the corporeal body. We must pay attention to movement. To embodiment. #RSA16 #g19
#i5 #RSA16 @DrJenTalbot parrhesia assumes static notions of embodiment and power`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// 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