childNodes[0] は String ではないので childNodes[0].match(/.../) などとするとエラーが出ます。 childNodes[0].localName とするといいようです。
事例
let pIndex = () => {
for (i = 0; i < elm_text.childNodes.length; i++) {
if (elm_text.childNodes[i].localName.match(/<p>/)) {
return i
}
}
}