forked from dylan-sutton-chavez/edge-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathre.json
More file actions
106 lines (106 loc) · 2.69 KB
/
re.json
File metadata and controls
106 lines (106 loc) · 2.69 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
[
{
"src": "print(match('abc', 'abcdef'))",
"output": ["abc"]
},
{
"src": "print(match(r'\\d+', '123abc'))\nprint(match(r'\\d+', 'abc123'))",
"output": ["123", "None"]
},
{
"src": "print(search(r'\\d+', 'abc123def'))\nprint(search(r'\\d+', 'abc'))",
"output": ["123", "None"]
},
{
"src": "print(fullmatch(r'\\d+', '123'))\nprint(fullmatch(r'\\d+', '123a'))",
"output": ["123", "None"]
},
{
"src": "print(search('<.*>', '<a><b>'))\nprint(search('<.*?>', '<a><b>'))",
"output": ["<a><b>", "<a>"]
},
{
"src": "print(search('a{2,3}', 'aaaa'))",
"output": ["aaa"]
},
{
"src": "print(search(r'[a-c]+', 'zzabcz'))\nprint(search(r'[^0-9]+', '12ab34'))",
"output": ["abc", "ab"]
},
{
"src": "print(search(r'\\bword\\b', 'a word here'))",
"output": ["word"]
},
{
"src": "print(search('cat|dog|fish', 'a dog b'))",
"output": ["dog"]
},
{
"src": "print(search('a.c', 'abc'))\nprint(search('a.', 'a\\nb') is None)\nprint(search('(?s)a.', 'a\\nb') is None)",
"output": ["abc", "True", "False"]
},
{
"src": "print(groups(r'(\\d+)-(\\d+)', 'x 12-34 y'))\nprint(groups(r'(\\d+)', 'abc'))",
"output": ["['12', '34']", "None"]
},
{
"src": "print(search(r'(\\w+) \\1', 'the the dog'))\nprint(search(r'(\\w+) \\1', 'the dog'))",
"output": ["the the", "None"]
},
{
"src": "print(search(r'\\d+(?= dollars)', 'pay 100 dollars'))\nprint(search(r'\\d+(?! dollars)', 'pay 100 euros'))",
"output": ["100", "100"]
},
{
"src": "print(search(r'(?<=\\$)\\d+', 'costs $42 today'))",
"output": ["42"]
},
{
"src": "print(search('(?i)hello', 'oh HELLO there'))",
"output": ["HELLO"]
},
{
"src": "print(search(r'\\w+', 'café'))",
"output": ["café"]
},
{
"src": "print(span(r'\\d+', 'áé123'))",
"output": ["[2, 5]"]
},
{
"src": "print(findall(r'\\d+', 'a1 b22 c333'))",
"output": ["['1', '22', '333']"]
},
{
"src": "print(findall(r'(\\d)\\d', '12 34 56'))",
"output": ["['1', '3', '5']"]
},
{
"src": "print(sub(r'\\d+', '#', 'a1b22c'))",
"output": ["a#b#c"]
},
{
"src": "print(sub(r'(\\w+)@(\\w+)', r'\\2.\\1', 'user@host'))",
"output": ["host.user"]
},
{
"src": "print(sub(r'(?P<x>\\d)', r'[\\g<x>]', 'a5b'))",
"output": ["a[5]b"]
},
{
"src": "search('(unbalanced', 'x')",
"error": "missing closing parenthesis"
},
{
"src": "search('a**', 'x')",
"error": "multiple repeat"
},
{
"src": "search('(?<=a+)b', 'x')",
"error": "lookbehind requires fixed width"
},
{
"src": "search('(a+)+$', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!')",
"error": "catastrophic backtracking"
}
]