doubei2231 2016-06-02 09:07
浏览 146
已采纳

PHP / Markdown:需要匹配反引号内的代码块

I am creating a developers site with code views, but when they type code i need to it a certain way so in the php and can convert it to html a special way,

The markdown i need to be able to work with is

```codechanger
``php
<?php ?>
``
``c#
$foo = bar;
``
```

So once the first regex select code changer I then need to be able to select each code but i just need to know the regex to match everything inside there even if it is on multiple lines.

This is what i was trying to use

preg_match_all("/\`\`codechanger.*?^\`\`[^
]*/s", $text, $out);

Any questions feel free to ask.

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥30 关于#网络安全#的问题:非对称加密验证
      • ¥20 关于线性代数里施密特正交化和QR分解的疑问
      • ¥15 matlab超类包含解析错误
      • ¥15 python拖拽文件问题
      • ¥15 执行import paddle代码出现错误如何解决?
      • ¥15 hisat2align exited with value 137
      • ¥15 寻找大学生合作开发软件(Delphi)
      • ¥30 AndroidBench&eMMC内存测试速度&Android
      • ¥15 W10 文件共享失败 怎么解决
      • ¥20 b站私信完整导出的方法