日期:2014-05-16  浏览次数:20325 次

javascript 正则应用例子

javascript 正则样例

例如 "23.09805,113.34303"
var report = /\d*\.\d*/g;

var data = url.match(report);

for(var i = 0;i < data.length;i++)
{
  document.write(data[0]);
}

php 正则样例

$str = "require_once 'xxxx/xxxaaaxx.php';";
$str = preg_replace('/require_once(.*?);/', '11', $str);
// This will be 'foo o' now
echo $str;


资料参考:
http://www.cnblogs.com/libinqq/archive/2008/07/31/1257699.html
http://www.cainiao8.com/web/js_note/js_regular_expression.html
http://www.cnblogs.com/westlake/articles/388873.html