0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MTテンプレート内でダブルクォートを置換したい時

Posted at

regrex_replaceでダブルクォート(")をJSON用にエスケープ(¥")しようとしたら
下記のような記述ではうまくできなかった

regex_replace="/¥"/g","¥¥""

シングルクォートを使えばいけました

regex_replace='/"/g','¥"'

参考

ダブルクォートとシングルクォートが混在する場合はこうすればいいらしい

<MTSetVarBlock name="regex0">/["']/g</MTSetVarBlock>
<MTSetVarBlock name="regex1">***</MTSetVarBlock>
<MTUnless regex_replace="$regex0","$regex1">"Tom and Jerry"</MTUnless>
→ ***Tom and Jerry***

めちゃくちゃ助かる

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?