dongtui0650 2018-07-25 12: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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化