作者superGA (kid...)
看板PHP
标题Re: [请益] 看不懂preg_replace函数的使用范例
时间Fri Dec 15 22:29:14 2006
这边有一份文件可以看
http://www.javaworld.com.tw/jute/post/view?bid=20&id=130126&sty=1&tpg=1&age=0
这是属於php的preg那类的 (不是ereg喔)
我之前是看这份文件学RE的 非常详细
好像没有直接回答到原PO的问题 lol
从一开始我就很讨厌RE...现在也是...
※ 引述《saininniang (sob)》之铭言:
: 下例传回值为 $startDate = 6/19/1969
: <?php
: $patterns = array("/(19|20\d{2})-(\d{1,2})-(\d{1,2})/", "/^\s*{(\w+)}\s*=/");
: $replace = array("\\3/\\4/\\1", "$\\1 =");
: print preg_replace($patterns, $replace, "{startDate} = 1969-6-19");
: ?>
: 这是我在google搜preg_replace函数的使用方法
: 但我怎麽看$patterns和$replace也没办法推测出像答案一样的结果
: 我的问题应该是卡在许多符号看不懂其代表的意思
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.119.112.156
※ 编辑: superGA 来自: 140.119.112.156 (12/15 22:32)