Js reg正则表达式
Upcoming SlideShare
Loading in...5
×
 

Js reg正则表达式

on

  • 532 views

正则表达式笔记。

正则表达式笔记。

Statistics

Views

Total Views
532
Slideshare-icon Views on SlideShare
532
Embed Views
0

Actions

Likes
0
Downloads
3
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Js reg正则表达式 Js reg正则表达式 Presentation Transcript

    • CHAPTER 10Pattern Matching with Regular Expressions 2011-04-11 dale Javascript正则表达式
    • 1. Definition• RegExp objects – var pattern = /s$/; – var pattern = new RegExp(); // use constructor Js Reg Perl Reg
    • 10.1.1 Literal Characters• Character Matches字母• Alphanumeric数字• Character字符• 0 The NUL character (u0000• t Tab (u0009)• n Newline (u000A)• v Vertical tab (u000B)• f Form feed (u000C) 换页• r• x• u• c
    • Special Character• ^$.*+?=!:|/()[]{}
    • 10.1.2 Character Classes• /[abc]/• /[a-z]/• /[a-zA-Z0-9]/ // Latin alphabet
    • 10.1.3 Repetition(repeat)• /dd/ //匹配2位数字• /dddd/ //匹配4位数字
    • • /(*‘”+)*^‘””+*1/ // ‘你好’ //“hello”
    • 实例var reg = /[a-zA-Z_]{6,9}/g;Var myString="guoguqoo0000_";reg.test(MyString);
    • String类与regular• myString.match(reg)• myString.replace(reg,$n)• myString.search(re) //-1 intIndex• myString.split(reg[,5]) //分割返回前5个
    • • /b^[a-z]w{5,7}b/