tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

RegExp_lastMatch.js (1719B)


      1 /* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 
      7 /**
      8   Filename:     RegExp_lastMatch.js
      9   Description:  'Tests RegExps lastMatch property'
     10 
     11   Author:       Nick Lerissa
     12   Date:         March 12, 1998
     13 */
     14 
     15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
     16 var TITLE   = 'RegExp: lastMatch';
     17 
     18 writeHeaderToLog('Executing script: RegExp_lastMatch.js');
     19 writeHeaderToLog( SECTION + " "+ TITLE);
     20 
     21 
     22 // 'foo'.match(/foo/); RegExp.lastMatch
     23 'foo'.match(/foo/);
     24 new TestCase ( "'foo'.match(/foo/); RegExp.lastMatch",
     25        'foo', RegExp.lastMatch);
     26 
     27 // 'foo'.match(new RegExp('foo')); RegExp.lastMatch
     28 'foo'.match(new RegExp('foo'));
     29 new TestCase ( "'foo'.match(new RegExp('foo')); RegExp.lastMatch",
     30        'foo', RegExp.lastMatch);
     31 
     32 // 'xxx'.match(/bar/); RegExp.lastMatch
     33 'xxx'.match(/bar/);
     34 new TestCase ( "'xxx'.match(/bar/); RegExp.lastMatch",
     35        'foo', RegExp.lastMatch);
     36 
     37 // 'xxx'.match(/$/); RegExp.lastMatch
     38 'xxx'.match(/$/);
     39 new TestCase ( "'xxx'.match(/$/); RegExp.lastMatch",
     40        '', RegExp.lastMatch);
     41 
     42 // 'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch
     43 'abcdefg'.match(/^..(cd)[a-z]+/);
     44 new TestCase ( "'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch",
     45        'abcdefg', RegExp.lastMatch);
     46 
     47 // 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); RegExp.lastMatch
     48 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/);
     49 new TestCase ( "'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\\1/); RegExp.lastMatch",
     50        'abcdefgabcdefg', RegExp.lastMatch);
     51 
     52 test();