doumin4553 2015-06-25 11:10
浏览 71
已采纳

PHP Preg_replace删除部分字符串

I Want to remove a part from string using preg_replace, i searched for long but i couldn't find a way to help me make the correct expression. the string:

test test test test test test test test test test test test test test     test test test test test test test test test test
<div>[[{"fid":"1915134","view_mode":"default","type":"media","attributes": {"height":360,"width":480,"alt":"#some text here","class":"media-element file-default"}}]]</div>
test test test test test test test test test test test test test testtest test test test test test test test test test
test test test test test test test test test test test test

Remove the part start with [[{"fid":" and end with }}]]

  • 写回答

1条回答 默认 最新

  • douxian9706 2015-06-25 11:14
    关注

    You can use this:

    $a = preg_replace('/\[\[{"fid"[^}\]]+}}\]\]/','',$a);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?