【问题标题】:Mix str_replace and regex?混合 str_replace 和正则表达式?
【发布时间】:2011-07-04 19:18:50
【问题描述】:

我想替换一个字符串,例如:

<input type="hidden" name="id" value="12345" />

但我遇到的问题是值 (12345) 每次都不同,所以我该怎么做? ..我猜是正则表达式,但没有线索

【问题讨论】:

    标签: php regex str-replace


    【解决方案1】:
    preg_replace('/\<input type="hidden" name="id" value="[0-9]+" \/\>/is', '', $source)
    

    【讨论】:

      猜你喜欢
      • 2021-09-20
      • 1970-01-01
      • 1970-01-01
      • 2021-03-21
      • 1970-01-01
      • 2019-12-11
      • 2011-05-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多