forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregex.js
More file actions
40 lines (30 loc) · 1.35 KB
/
regex.js
File metadata and controls
40 lines (30 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
var x = /World/;
var y = new RegExp("l", "g");
var z = new RegExp("l", "g");
y.exec("Hello World");
z.lastIndex = -1;
var re = /abc/i;
var re1 = new RegExp(re, "gm");
WScript.SetTimeout(testFunction, 50);
/////////////////
function testFunction()
{
telemetryLog(`re.global == ${re.global}`, true); //false
telemetryLog(`re.multiline == ${re.multiline}`, true); //false
telemetryLog(`re.ignoreCase == ${re.ignoreCase}`, true); //true
telemetryLog(`re1.global == ${re1.global}`, true); //true
telemetryLog(`re1.multiline == ${re1.multiline}`, true); //true
telemetryLog(`re1.ignoreCase == ${re1.ignoreCase}`, true); //false
telemetryLog(`y.lastIndex: ${y.lastIndex}`, true); //3
telemetryLog(`z.lastIndex: ${z.lastIndex}`, true); //3
////
var m = "Hello World".match(x);
y.exec("Hello World");
////
telemetryLog(`m.index: ${m.index}`, true); //6
telemetryLog(`post update -- y.lastIndex: ${y.lastIndex}`, true); //4
}