• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023-2025 Huawei Device 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 let regex: RegExp = new RegExp("bc*d");
17
18 let regex2: RegExp = new RegExp("bc*d");
19
20 const regex3 = new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(\\.[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)*$");
21 const regex4: RegExp = new RegExp('^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(\.[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)*$');
22
23 let regex5: RegExp = new RegExp("bc*d", "ig");
24
25 let regex6: RegExp = new RegExp("bc*d", "ig");
26
27 let regex7: RegExp = new RegExp(new RegExp("bc*d", "i"), "g");
28
29 let regex8: RegExp = new RegExp(new RegExp("bc*d", "i"), "g");
30
31 let regex9: RegExp = new RegExp("a\\\\");
32
33 let regex10: RegExp = new RegExp("a\\\\");
34
35 class A {
36     static readonly classregex0: RegExp = new RegExp("bc*d")
37
38     static readonly classregex2 = new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(\\.[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)*$");
39
40     classregex3: RegExp = new RegExp("bc*d");
41
42     static staticMethodOne() {
43         let regex = new RegExp("bc*d")
44     }
45
46     static staticMethodTwo() {
47         let regex: RegExp = new RegExp("/bc*d/");
48     }
49
50     methodOne() {
51         let regex = new RegExp("bc*d")
52     }
53
54     methodTwo() {
55         let regex: RegExp = new RegExp("/bc*d/");
56     }
57
58     methodRet(): RegExp {
59         return new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(\\.[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)*$");
60     }
61 }
62
63 const regexLambda = () => new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(\\.[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)*$");
64
65 let regex12: RegExp = new RegExp("ab*c")
66
67 let regex13: RegExp = new RegExp("ab*c", "i")
68
69 let a27: RegExp = new RegExp('dawfgr' + '12345')
70
71 let a25: RegExp = new RegExp('.∗?(?:(?:元宵|三八|妇女|母亲|父亲|七夕|重阳|情人|儿童|六一' + '|愚人|复活|青年|护士|建军|教师|建党|万圣|感恩|秘书|七一|五四|八一|腊八|光棍|植树|中元)节|除夕|大年三十|大年30|七夕' + '|平安夜|六一|七一|五四|八一|三八|腊八|双十一|双十二).∗');
72
73 let regex20: RegExp = new RegExp('dawfgr'.concat('12345'))
74
75  let a28: RegExp = new RegExp('dawfgr' + '12345' + '789')
76