int preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] )

例子:preg_match("/php/i", "PHP is the web scripting language of choice.")

关于$pattern,定界符不一定要是 /,如 /string/。当要匹配的字符串里含有 / 时,就不能用 /作为定界符了,可以用@ #等等。如"@php@i"

例子:preg_match('@^(?:http://)?([^/]+)@i',"http://www.php.net/index.html", $matches);

另外i表示不区分大小写,但是不支持g(其他语言里表示匹配全部),匹配全部用preg_match_all()。

最新文章

  1. 在PowerShell中使用curl(Invoke-WebRequest)
  2. js加密解密
  3. jquery选择器(原创)<四>
  4. Python报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal not in range(128)
  5. HDU Destroy Transportation system(有上下界的可行流)
  6. 使用Ant命令压缩JavaScript文件
  7. avconv转换视频
  8. noip 2005 等价表达式
  9. NAS4Free 安装配置(四)配置硬盘
  10. Node中npm 安装问题
  11. poj 2992
  12. poj 1011 Sticks ,剪枝神题
  13. 蓝桥网试题 java 基础练习 数列排序
  14. 2、公司部门的组成 - CEO之公司管理经验谈
  15. UVA 1146 Now or later
  16. centos7安装配置tomcat9
  17. get函数
  18. RQNOJ 3 Jam的计数法
  19. spring boot(一):Hello World
  20. [20171106]修改show spparameter的显示宽度.txt

热门文章

  1. Python框架之Django学习
  2. SQL Server 数据库定时自动备份
  3. Android学习路径(四)文件项目学习的名单,android显示单元经常使用的
  4. rapid-framework脚手架快速搭建springMVC框架项目
  5. Redis简介与简单安装
  6. iOS后向兼容:如何发现过期接口
  7. ASP.NET MVC应用程序更新相关数据
  8. Bootstrap 模态框(也可以说的弹出层)
  9. Object Pool
  10. IOS UI 第一篇:基本UI