- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试从站点中删除一些已弃用的代码。谁能告诉我 preg 相当于
ereg_replace("<b>","<strong>",$content);
谢谢。
最佳答案
似乎根本不需要正则表达式。
一个简单的str_replace会做:
$cleaned = str_replace ('<b>', '<strong>', $unCleaned);
如果你需要更复杂的替换,例如检查属性,你可以这样做:
$cleaned = preg_replace('/<b(\s[^>]*)?>/', '<strong\\1>', $unCleaned);
但这绝不是完美的;类似 <div title="foo->bar"></div>
的东西会破坏正则表达式。
关于PHP - 用 preg 替换 ereg,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1497417/
我已经开始学习PHP了。所以在我的 windows 7 机器上安装了 WAMP 服务器。我正在尝试以下 PHP 代码: 在我的 mozilla 中尝试这个时,我得到了输出: Deprecated:
我有 150 多个 PHP 文件需要更改(将 ereg 更新为 preg_match)。我厌倦了手动更新它们,但它需要永远,我想确保我的所有替换都能在第一次工作。我该怎么做才能进行这种操作? 这是我的
我注意到在 PHP 正则表达式库中可以在 ereg 和 preg 之间进行选择。有什么区别?一个比另一个快吗?如果是,为什么不弃用较慢的那个? 是否存在使用一种优于另一种的情况? 最佳答案 访问 ph
我正在尝试从站点中删除一些已弃用的代码。谁能告诉我 preg 相当于 ereg_replace("","",$content); 谢谢。 最佳答案 似乎根本不需要正则表达式。 一个简单的str_rep
我是 Reg Ex 的新手,并不完全理解不同风格之间的区别。但是,我有一个基本的 Reg Ex,当我通过 UNIX 系统(vi 和 grep)尝试它时它可以工作,但当我尝试在 PHP 的 ereg 函
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: How can I convert ereg expressions to preg in PHP? 我的联
这个问题在这里已经有了答案: How can I convert ereg expressions to preg in PHP? (4 个答案) 关闭 3 年前。 我开发了一个大型 PHP 应用程
为什么 ereg 在 PHP 中被弃用? 我有很多函数使用了它,现在它们总是发出警告。 还有什么选择呢? 最佳答案 Ereg 已被弃用,因为它已被 PCRE 扩展取代。它被替换和弃用的原因在下面的链接
这个问题在这里已经有了答案: How can I convert ereg expressions to preg in PHP? (4 个答案) 关闭 3 年前。 我正在使用一些简单的正则表达式。
本文实例讲述了php5.3提示Function ereg() is deprecated Error问题解决方法。分享给大家供大家参考。具体实现方法如下: 1、问题: PHP 5.3 ereg
这个问题在这里已经有了答案: How can I convert ereg expressions to preg in PHP? (4 个回答) 2年前关闭。 我正在尝试转换以下 ereg()调用使
我只是想调整我的代码以兼容 php 5.3 (6.0)。所以我想用相应的 preg 函数替换所有对 ereg 函数的调用。 但后来我看到 mb_ereg 函数没有被标记为已弃用。所以我只是想知道依赖它
我的代码是: 我弄错了?为什么? 最佳答案 因为ereg不支持\d,所以需要使用[0-9]。 并且 ereg 已弃用,请改用 preg_match,然后您可以使用 \d。 if(preg_match
由于 POSIX regular expressions (ereg) 自 PHP 5.3.0 起已弃用,我想知道一种将旧表达式转换为 PCRE (Perl Compatible Regular Ex
这个问题在这里已经有了答案: How can I convert ereg expressions to preg in PHP? (4 个回答) 关闭 3 年前。 很抱歉提出问题,但在理解正则表达式
首先来看看 POSIX 风格正则表达式的两个主要函数: ereg 函数:(正则表达式匹配) 格式:int ereg ( string pattern, string st
我正在尝试使用 ereg 在 php 中验证电子邮件,其中不允许在 @ 之后输入超过两个点,并且不能以任何特殊字符开头,我该怎么做。 function chk($a) { $pattern = "^(
我正在尝试使用 ereg 在 php 中验证电子邮件,其中不允许在 @ 之后输入超过两个点,并且不能以任何特殊字符开头,我该怎么做。 function chk($a) { $pattern = "^(
我正在尝试转换 XSD一些 C# 类。我已经用很多其他文件完成了此操作,但我想知道为什么这个文件不起作用。 schema information在下载部分包含指向 the XSD file 的链接我已
在php5.3环境下运行,常常会出现 Deprecated: Function ereg() is deprecated in...和Deprecated: Function ereg
我是一名优秀的程序员,十分优秀!