1/*
2 * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/*
17 * @tc.name:regexpflagd
18 * @tc.desc:test Regexp d flag
19 * @tc.type: FUNC
20 * @tc.require: issueI5NO8G
21 */
22var regexpNames = /姓氏:(?<first>.+),名字:(?<last>.+)/gmd;
23var users = `姓氏:李,名字:雷\n姓氏:韩,名字:梅梅`;
24var result = regexpNames.exec(users);
25print(regexpNames.hasIndices);
26print(regexpNames.flags);
27print(result.indices[0]);
28print(result.indices[1]);
29print(result.indices[2]);
30print(result.indices.groups.first);
31print(result.indices.groups.last);
32print(result.groups.first);
33print(result.groups.last);
34
35result = regexpNames.exec(users);
36print(result.indices[0]);
37print(result.indices[1]);
38print(result.indices[2]);
39print(result.indices.groups.first);
40print(result.indices.groups.last);
41print(result.groups.first);
42print(result.groups.last);
43
44var result2 = "bπb".match(/(π)/du).indices;
45print(result2[0]);
46print(result2[1]);
47print(result2.groups);
48
49var regexpFlags = new RegExp("", "dgimsuy").flags;
50print(regexpFlags);
51
52print(Reflect.set({}, 4294967284, {}, new Int32Array()))