1.JavaScript-Regex基礎

來源:互聯網
上載者:User

標籤:asc   att   highlight   alt   替換   支援   style   com   class   

JavaScript RegExp對象

 

一。RegExp對象

Regex是描述字元模式的對象。

Regex用於對字串模式比對及檢索替換,是對字串執行模式比對的強大工具。

1.文法

1 var patt=new RegExp(pattern,modifiers);  //方式12 var patt= /pattern/modifiers;            //方式2

  *pattern(模式) 描述了運算式的模式

  *modifiers(修飾符) 用於指定全域匹配,區分大小寫匹配和多行匹配

2.修飾符

修飾符用於執行區分大小寫和全域匹配

3.元字元

元字元是擁有特殊含義的字元

4.量詞

 

 5.方括弧

方括弧用於尋找某個範圍內的字元

 

 

二.RegExp對象方法

1.基本方法

2.支援Regex的String方法

 

 

 

 

  

 

1.JavaScript-Regex基礎

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.