Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- console.dir( /(\w\d)(\w\d)(\w\d)/.exec('a1b2c3d4e5f6g7h8i9') );
- // 0: "a1b2c3"
- // 1: "a1"
- // 2: "b2"
- // 3: "c3"
- // groups: undefined
- // index: 0
- // input: "a1b2c3d4e5f6g7h8i9"
- // length: 4
- console.dir( /(a1) (b2) \1 \2/.exec('a1 b2 a1 b2') );
- // 0: "a1 b2 a1 b2"
- // 1: "a1"
- // 2: "b2"
- // groups: undefined
- // index: 0
- // input: "a1 b2 a1 b2"
- // length: 3
- console.log( 'a1b2c3'.replace(/(\w\d)(\w\d)(\w\d)/, '$3,$2,$1') );
- // c3,b2,a1
- console.log( 'a1b2c3'.replace(/(\w\d)(\w\d)(\w\d)/, '($&)') );
- // (a1b2c3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement