代码之家  ›  专栏  ›  技术社区  ›  Manos Dilaverakis

在PHP代码中获取引用文本的正则表达式

  •  1
  • Manos Dilaverakis  · 技术社区  · 16 年前

    <?php echo $this->__("mytext");?>somesometext")moretext
    

    /\$this->__\([\'"](.*)[\'"]\)/
    

    mytext");?>somesometext
    

    有人能让这个工作吗?

    3 回复  |  直到 14 年前
        1
  •  2
  •   Richard Nguyen    16 年前
    /\$this->__\([\'"](.*?)[\'"]\)/
    

    这个 ? 使 *

        2
  •  3
  •   Gumbo    16 年前

    token_get_all ,逐步通过代币,并在第一个处停止 T_CONSTANT_ENCAPSED_STRING token

        3
  •  2
  •   Stefan Gehrig    16 年前
    /\$this->__\([\'"](.*?)[\'"]\)/
    

    ? 将匹配模式切换为 粗俗的 .