<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool教程(w3cschool.cn)</title>
</head>
<body>
<h1>我的第一个 Web 页面</h1>
<button id = "demo">clock me</button>
<script>
document.getElementById("demo").addEventListener("click",myfun);
function myfun(){
//JavaScript 正则表达式
//定义:正则表达式是由一个字符序列形成的搜索模式
//语法:pattern/modifiers

//test方法
var a = new RegExp("mike");
document.write(a.test("mike is the best"));

//exec方法
var b = new RegExp("love");
document.write(b.exec("mike have love a girl some years ago"));

//compile方法
//replace方法
var c="her name is lina";
patt=/(li)?na/g;
patt.compile(patt);
document.write(c.replace(patt,"nana"));

//search方法
var d = "i wish lina has a happy life everyday";
document.write(d.search("lina"));

}

</script>

</body>
</html>

最新文章

  1. 学习PYTHON之路, DAY 6 - PYTHON 基础 6 (模块)
  2. MonkeyRunner测试一MonkeyRunner的使用
  3. android-sdks/build-tools/17.0.0/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
  4. POJ 3041 匈牙利算法模板题
  5. yii框架中应用jquery表单验证插件
  6. 关于 2dx v3.7 UIScale9Sprite的bug
  7. BZOJ 1717: [Usaco2006 Dec]Milk Patterns 产奶的模式
  8. Linux的进程优先级-邹立巍
  9. SQLite.dll混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该程序集。
  10. iOS7 NavigationController 右滑手势问题
  11. String的使用
  12. JavaScript的this和作用域
  13. xshell6 评估期已过 解决办法
  14. 初识ldap
  15. 约定优于配置---Java的eclipse项目配置
  16. redis学习链接收藏
  17. win10下乌龟git安装和使用(转)
  18. PHP 定界符
  19. The Win32 Rundll and Rundll32 Interface Related Topics
  20. AngularJS的初步学习(1)

热门文章

  1. spring boot 整合JPA bean注入失败
  2. NOIP 模拟 $11\;\rm math$
  3. Socket编程 Tcp和粘包
  4. C#基础知识---动态为类型添加属性
  5. 梯度下降做做优化(batch gd、sgd、adagrad )
  6. Mysql 中隐式转换
  7. HbaseWAL
  8. ArrayPool 源码解读之 byte[] 也能池化?
  9. 使用selenium模拟登录12306网站
  10. MySQL数据库迁移之data目录