Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2534821
  • 博文数量: 245
  • 博客积分: 4125
  • 博客等级: 上校
  • 技术积分: 3113
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-25 23:56
文章分类

全部博文(245)

文章存档

2015年(2)

2014年(26)

2013年(41)

2012年(40)

2011年(134)

2010年(2)

分类: JavaScript

2013-07-22 18:22:03


Syntax

RegExpObject.test(string)

JS中正则表达式pattern写在两个顺斜杠之间  .

Example

Do a global search, and test for "Hello" and "W3Schools" in a string:

The output of the code above will be:

Returned value: true
Returned value: false


var val="abc def 134";
 val.replace(/\W/g, "");//去空格
阅读(1391) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

甜心1832013-07-23 11:07:37

正则表达式