String.replace() with regex is not replacing matched string – no, it’s not a duplicate question [duplicate]

I’ve been struggling with this for a bit and coming up short. I could use some quick guidance:

    let str = `
    value i'm trying to match
    `

    let regex = str.replace(`/^`+str+`.*n?/gm`, 'something else')
    console.log(str == regex) // true, why?

It is not a duplicate of that question. The same is true for:

    let str = 'value i'm trying to match'

    let regex = str.replace(`/^`+str+`.*n?/gm`, 'something else')
    console.log(str == regex) // true, why?