dongtui0650 2018-07-25 04:04
浏览 89

preg_replace_callback quirk? 与某种类型的字符串不匹配

Is this some quirk with the preg_replace_callback function or something?

The full code is really complex but I'll post the specific problem here which I found after alot of debugging, a specific type of tag doesn't get matched at all, any ideas why this could be?

preg_replace_callback('/(?:<del>(.|
)*?<\/del>)|(?:<ins>(.|
)*?<\/ins>)|(?P<DOT>[\s\S])/', function($match) {
//does something and runs fully for every tag except the tag below 
}

it matches other tags including html inside del tags but this sort of img tag isn't matched for some reason and the code just crashes at this point without calling the callback function at all. I checked using an online regex tester that this should match.

<del><img src="?tpl=img&amp;url=1/68/thumb/Back-View-Of-Statue-Of-Liberty-With-Full-Moon.jpg" srcset="?tpl=img&amp;url=1/68/thumb/Back-View-Of-Statue-Of-Liberty-With-Full-Moon.jpg 320w,?tpl=img&amp;url=1/68/med/Back-View-Of-Statue-Of-Liberty-With-Full-Moon.jpg 480w,?tpl=img&amp;url=1/68/large/Back-View-Of-Statue-Of-Liberty-With-Full-Moon.jpg 640w" sizes="(max-width:320px) 320px, (max-width:480px) 480px, 640px"></del>

Just asking incase anyone has a clue or could point me in the right direction.

  • 写回答

0条回答 默认 最新

      编辑
      预览

      报告相同问题?

      手机看
      程序员都在用的中文IT技术交流社区

      程序员都在用的中文IT技术交流社区

      专业的中文 IT 技术社区,与千万技术人共成长

      专业的中文 IT 技术社区,与千万技术人共成长

      关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

      关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

      客服 返回
      顶部