-4
を含む文字列を検索し、ラップ次の文字列を考えてみましょうスパンタグ?例えば改行
You look away whilst I weave needles
<span>through my skin to seal the scars,
running repairs, not alterations.</span>
現在、私は持っている:任意の\r\n
を含まない文字列のために正常に動作します
let regex = new RegExp(stringToMatch,'m'); //I thought 'm', multiline might work?
poem = poem.replace(regex, '<span>' + stringToMatch + '</span>')
。