doujiang1939 2012-06-06 12:45
浏览 39
已采纳

PHP PCRE:匹配大括号内容

I'm trying to replace the contents inside braces on a string with preg_replace_callback. Here's an example string :

230|321;312|123;{413|333;413|334;413|335};583|221

What I want to do is being able to replace what's inside braces ({413|333;413|334;413|335}) with something else, but I can't quite figure out how to go as for the regex expression. I've tried some but with no results.

Little help?

Thanks!

  • 写回答

1条回答 默认 最新

  • dqsvf28682 2012-06-06 12:50
    关注

    If you want to match everything from opening brace to close brace:

    /{[^}]+}/
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab有关常微分方程的问题求解决
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable