js正则表达式语法大全(JS regular expression syntax Daquan)

js正则表达式语法大全(JS regular expression syntax Daquan)

regular expression syntax

A regular expression is a text pattern consisting of regular characters (such as characters a to Z) and special characters (called meta characters). This pattern describes one or more strings to match when searching for a text body. A regular expression, as a template, matches a character pattern with the string it searches for.

Here are some examples of regular expressions that might be encountered:

JScript VBScript matching

/^\[\t]*$/ "^\[\t]*$, a blank line.

/\d{2}-\d{5}/ "\d{2}-\d{5}" verifies whether a ID number is made up of a 2 digit number, a hyphen, and a 5 digit number.

/ (. *) ">.*/" (. *) >.*, a HTML marker.

The following table is a complete list of meta characters and their behavior in the context of regular expressions:

Character description

Mark the next character as a special character, or a literal character, or a backward reference, or an octal escape character. For example, the'n'matches the character "n"". '\n'matches a newline character. Sequence matching "\" and \ \ '\ ("," (".

Matches the start position of the input string. If you set the Multiline attribute of the RegExp object, ^ matches the position after'\n'or'\r'.

$matches the end position of the input string. If the Multiline property of the RegExp object is set, $matches the location before'\n'or'\r'.

* matches the previous sub expression zero or more times. For example, zo* can match "Z" and "zoo"". * equivalent to {0}.

+ matches the previous sub expression one or more times. For example,'zo+'matches "Zo" and "zoo", but does not match "Z"". + is equivalent to {1}.

Matches the previous sub expression zero or twice. For example, "do (ES)" can match the "do" in "do" or "does"". Equivalent to {0,1}?.

{n} n is a nonnegative integer. Match the specified n times. For example,'o{2}'does not match the'o' in Bob, but it matches the two o in food.

{n,} n is a nonnegative integer. Match at least n times. For exa

html js 正则表达式语法大全,js正则表达式语法大全(JS regular expression syntax Daquan).doc...相关推荐

  1. Perl Regular Expression Syntax Perl的正则表达式语法

    Perl Regular Expression Syntax Perl的正则表达式语法  Synopsis 摘要  The Perl regular expression syntax is base ...

  2. java正则开头结尾_以m开头以d结尾的正则表达式-正则表达式以什么开头-正则表达式不以0开头...

    正则表达式:数字开头中间字母结尾数字 如果你的结尾数字是多个也可以的话,你就要再加上一个+号,另外,中间的字母允许大写幺?允许的话要再加上A-Z,所以你可以改这样试试: "^[0-9]+[a ...

  3. 10、正则表达式 (笔试题、语法规则、正则对象方法、正则实例属性、支持正则表达式的String对象的方法、贪婪匹配与非贪婪匹配)

    正则表达式 目录 10.1 语法规则 10.1.1 创建方法 1.直接量 2.构造方法RegExp() 10.1.2 三个属性i,g,m 10.1.3 方括号 10.1.4 元字符 10.1.5 量词 ...

  4. js进阶正则表达式方括号(方括号作用)(js正则是在双正斜杠之中:/[a-z]/g)...

    js进阶正则表达式方括号(方括号作用)(js正则是在双正斜杠之中:/[a-z]/g) 一.总结 方括号:范围 圆括号:选 大括号:数量 1.js正则是在双正斜杠之中: var reg2=/[a-z]/ ...

  5. js正则贪婪模式_C# 正则表达式贪婪模式案例

    案例一. 如 "acbacb"  正则  "a.*?b" 只会取到第一个"acb" 原本可以全部取到但加了限定符后,只会匹配尽可能少的字符 ...

  6. eclipse加速之禁用JS、jsp等文件的语法验证

    eclipse加速之禁用JS.jsp等文件的语法验证 去除eclipse的JS验证: 将windows->preference->Java Script->Validator-> ...

  7. Js基础引导(二)——语法

    朋友,你好. 欢迎进入JS基础引导--语法篇,本篇内容是JS的基本概念(常识) 语法: JS语法大量借鉴了其他C语言或者类C语言(如java),因此,熟悉这些语言对于学习JS会很轻松,同样的,会了JS ...

  8. JS中的BOM、正则表达式、定时器

    一.BOM 浏览器对象模型 (BOM-Browser Object Model) 使 JavaScript 有能力与浏览器"对话". 由于现代浏览器已经(几乎)实现了 JavaSc ...

  9. js 最新手机号码、电话号码正则表达式

    js最新手机号码.电话号码正则表达式 正则表达式(regular expression)是一个描述字符模式的对象.使用JavaScript正则表达式可以进行强大的模式匹配和文本检索与替换功能. 手机号 ...

最新文章

  1. ecshop模板的原理分析
  2. 物联网白皮书【2018】重磅发布|今年的物联网产业交出了一张怎样的答卷
  3. mpvue+vant app搭建微信小程序
  4. Windows下配置sphinx+reStructuredText详解
  5. php redis新增数据类型,Redis有哪几种数据类型
  6. mysql 终端模拟_mysql客户端模拟脏读、幻读和可重复读
  7. Coding and Paper Letter(二)
  8. 服务器产品的特质和优势,亿速云裸金属服务器兼具“弹性”和“裸金属”两种属性,既有虚拟机的弹性,同时又保留了裸金属的一切性能、特性和优势!...
  9. 一站式学习Wireshark(三):应用Wireshark IO图形工具分析数据流
  10. java基于ssm医院病历管理系统
  11. “CSIG 计算机视觉前沿 · 研讨会”于6月28日在百度举行
  12. Contrastive Learning
  13. Monkey详解(脚本篇---获取坐标)
  14. 2022年安全员-B证考试题库及安全员-B证模拟试题
  15. QQ留言代码,网页QQ留言
  16. 2022年上半年信息系统项目管理师上午客观题参考答案及解析(四)
  17. leaflet实现风场流动
  18. 数据降维的几种方法(转)
  19. Cache(缓存)基本概念
  20. 【Git配置技巧】01. 配置文件git config介绍

热门文章

  1. 四、DOM-事件高级
  2. 做有声播客月赚5.9万?37岁大叔公开分享自己的经验帮你学习
  3. Win8系统安装教程【附Win8/64位系统下载地址】
  4. alter table XXXX drop partition xxxx 不释放存储空间问题
  5. Android Studio VT-x is disabled in BIOS 的解决办法
  6. linux 三剑客之grep
  7. thinkpad e430c + ubuntu 电脑降温措施
  8. 两个HC-05蓝牙模块互相绑定构成无线串口模块 1
  9. php解析rss格式新闻源,订阅一些RSS新闻源来阅读电子报纸
  10. 经典卷积网络学习----FCN(图像分割)