-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamples.regexl
executable file
·110 lines (100 loc) · 2.29 KB
/
examples.regexl
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
107
108
109
110
// /friend/
// Strings that can match:
// 'Hello there, friend! This is Omar'
set_options({
find_all_matches: false,
})
select 'friend'
// /is|Omar/g
// Strings that can match:
// 'Hello there, friend! This is Omar'
set_options({
find_all_matches: true,
})
select any_strings_of('is', 'Omar')
// /[isomar]/gi
// Strings that can match:
// 'Hello there, friend! This is Omar'
set_options({
find_all_matches: true,
case_sensitive: false,
})
select any_chars_of('is', 'omar')
// /^friend/i
// Strings that can match:
// 'Friend, how are you?'
set_options({
case_sensitive: false,
})
select starts_with('friend')
// /omar$/i
// Strings that can match:
// 'Hello there, friend! This is Omar'
set_options({
case_sensitive: false,
})
select ends_with('omar')
// /^Golang$/
// Strings that can match:
// 'Golang'
select starts_and_ends_with('Golang')
// select ends_with(starts_with('Golang')) // Alternative way of writing it
// /^Hello.*Omar/g
// Strings that can match:
// 'Hello there, friend! This is Omar'
set_options({
find_all_matches: true,
})
select starts_with('Hello') + any_chars() + 'Omar'
// /Hello*/g
// Equivalent to: /Hello*/g
// Strings that can match:
// 'Hello there, friend!'
// 'Hell there, friend!'
// 'Hellooooo there, friend!'
set_options({
find_all_matches: true,
})
select 'Hell' + zero_plus_of('o')
// /Hell(o)+/g
// Equivalent to: /Hello+/g
// Strings that can match:
// 'Hello there, friend!'
// 'Helloooo' will match but not 'Hell'
set_options({
find_all_matches: true,
})
select 'Hell' + one_plus_of('o')
// /(Hello)+/g
// Strings that can match:
// 'Hello'
// 'HelloHelloHello there, friend!'
set_options({
find_all_matches: true,
})
select one_plus_of('Hello')
// [A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,10}
// Strings that can match:
// '[email protected]'
set_options({
case_sensitive: false,
})
select
// Converts to: [A-Z0-9._%+-]+
one_plus_of(
any_chars_of(from_to('A', 'Z'), from_to(0, 9), '._%+-')
) +
// Converts to: @
'@' +
// Converts to: [A-Z0-9.-]+
one_plus_of(
any_chars_of(from_to('A', 'Z'), from_to(0, 9), '.-')
) +
// Converts to: \.
'.' +
// Converts to: [A-Z]{2,10}
char_count_between(
any_chars_of(from_to('A', 'Z')),
2,
10
)