const regex = /(?sx)([ぁ-ゔ])(?=.*:\1=(.))/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(?sx)([ぁ-ゔ])(?=.*:\\1=(.))', 'gm')
const str = `このビルディングのベースメントはレストランとカフェがあります。
Dictionary:ぁ=ァ:あ=ア:ぃ=ィ:い=イ:ぅ=ゥ:う=ウ:ぇ=ェ:え=エ:ぉ=ォ:お=オ:か=カ:が=ガ:き=キ:ぎ=ギ:く=ク:ぐ=グ:け=ケ:げ=ゲ:こ=コ:ご=ゴ:さ=サ:ざ=ザ:し=シ:じ=ジ:す=ス:ず=ズ:せ=セ:ぜ=ゼ:そ=ソ:ぞ=ゾ:た=タ:だ=ダ:ち=チ:ぢ=ヂ:っ=ッ:つ=ツ:づ=ヅ:て=テ:で=デ:と=ト:ど=ド:な=ナ:に=ニ:ぬ=ヌ:ね=ネ:の=ノ:は=ハ:ば=バ:ぱ=パ:ひ=ヒ:び=ビ:ぴ=ピ:ふ=フ:ぶ=ブ:ぷ=プ:へ=ヘ:べ=ベ:ぺ=ペ:ほ=ホ:ぼ=ボ:ぽ=ポ:ま=マ:み=ミ:む=ム:め=メ:も=モ:ゃ=ャ:や=ヤ:ゅ=ュ:ゆ=ユ:ょ=ョ:よ=ヨ:ら=ラ:り=リ:る=ル:れ=レ:ろ=ロ:ゎ=ヮ:わ=ワ:ゐ=ヰ:ゑ=ヱ:を=ヲ:ん=ン:ゔ=ヴ:ヵ=ヵ:ヶ=ヶ:わ゙=ヷ:ゐ゙=ヸ:ゑ゙=ヹ:ヺ=ヺ`;
const subst = `$2`;
// 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