This repository has been archived by the owner on Feb 3, 2021. It is now read-only.
/
rx_metachars
263 lines (261 loc) · 10.6 KB
/
rx_metachars
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
## Metacharacter tests
. a y dot (.)
. \n y dot (.)
. '' n dot (.)
a\s+f abcdef n whitespace (\s)
ab\s+cdef ab cdef y whitespace (\s)
a\S+f abcdef y not whitespace (\S)
a\S+f ab cdef n not whitespace (\S)
^ abc abcdef y start and end of string (^)
^ abc abc\ndef y start and end of string (^)
^ abc def\nabc n start and end of string (^)
def \n ^ abc def\nabc n start and end of string (^)
def $ abcdef y start and end of string ($)
def $ abc\ndef y start and end of string ($)
def $ def\nabc n start and end of string ($)
def $ \n abc def\nabc n start and end of string (^)
abc \n $ abc\n y end of string ($)
abc $ abc\n n end of string ($)
<<def abc-def y left word boundary, beginning of word
<<bc abc-def n left word boundary, mid-word
c<< abc-def n left word boundary, end of word
<<abc abc-def y left word boundary, BOS
def<< abc-def n left word boundary, EOS
<< ------- n left word boundary, no word chars
>>def abc-def n right word boundary, beginning of word
>>bc abc-def n right word boundary, mid-word
c>> abc-def y right word boundary, end of word
>>abc abc-def n right word boundary, BOS
def>> abc-def y right word boundary, EOS
>> ------- n right word boundary, no word chars
c \n d abc\ndef y logical newline (\n)
# todo :pugs<feature>
c \n d abc\rdef y logical newline matches \r
c \n+ d abc\n\ndef y logical newline quantified
a\n+f abcdef n logical newline (\n)
c \n d abc\n\rdef n logical newline matches \n\r
# todo :pugs<feature>
c \n d abc\r\ndef y logical newline matches \r\n
b \n c abc\ndef n logical newline (\n)
\N a y not logical newline (\N)
a \N c abc y not logical newline (\N)
\N '' n not logical newline (\N)
c \N d abc\ndef n not logical newline (\N)
c \N d abc\rdef n not logical newline (\N)
c \N+ d abc\n\ndef n not logical newline (\N)
a\N+f abcdef y not logical newline (\N)
c \N d abc\n\rdef n not logical newline (\N)
c \N d abc\r\ndef n not logical newline (\N)
b \N \n abc\ndef y not logical newline (\N)
\Aabc Aabc /Obsolete/ retired metachars (\A)
\Aabc abc\ndef /Obsolete/ retired metachars (\A)
abc\Z abcZ /Obsolete/ retired metachars (\Z)
abc\Z abc\ndef /Obsolete/ retired metachars (\Z)
abc\z abcz /Obsolete/ retired metachars (\z)
def\z abc\ndef /Obsolete/ retired metachars (\z)
abc # def abc#def y comments (#)
abc # xyz abc#def y comments (#)
abc # def \n \$ abc#def y comments (#)
abc \# def abc#def y comments (#)
abc \# xyz abc#def n comments (#)
^ abc \# def $ abc#def y comments (#)
^^ abc \n ^^ def abc\ndef y line beginnings and endings (^^)
# todo :pugs<feature>
^^ abc \n ^^ def \n ^^ abc\ndef\n n line beginnings and endings (^^)
^^ \n \n y line beginnings and endings (^^)
# todo :pugs<feature>
\n ^^ \n n line beginnings and endings (^^)
abc $$ \n def $$ abc\ndef y line beginnings and endings ($$)
# todo :pugs<feature>
abc $$ \n def $$ \n $$ abc\ndef\n n line beginnings and endings ($$)
$$ \n \n y line beginnings and endings ($$)
# todo :pugs<feature>
\n $$ \n n line beginnings and endings ($$)
<[a..d]> | <[b..e]> c y alternation (|)
<[a..d]> | <[d..e]> c y alternation (|)
<[a..b]> | <[b..e]> c y alternation (|)
<[a..b]> | <[d..e]> c n alternation (|)
<[a..d]>+ | <[b..e]>+ bcd y alternation (|)
^ [ <[a..d]>+ | <[b..e]>+ ] $ bcd y alternation (|)
^ [ <[a..c]>+ | <[b..e]>+ ] $ bcd y alternation (|)
^ [ <[a..d]>+ | <[c..e]>+ ] $ bcd y alternation (|)
b| bcd /Null pattern/ alternation (|) - null right arg illegal
|b bcd y alternation (|) - null left arg ignored
| bcd /Null pattern/ alternation (|) - null both args illegal
\| | y alternation (|) - literal must be escaped
| | /Null pattern/ alternation (|) - literal must be escaped
# todo :pugs<feature>
<[a..d]> & <[b..e]> c y conjunction (&)
<[a..d]> & <[d..e]> c n conjunction (&)
<[a..b]> & <[b..e]> c n conjunction (&)
<[a..b]> & <[d..e]> c n conjunction (&)
# todo :pugs<feature>
<[a..d]>+ & <[b..e]>+ bcd y conjunction (&)
# todo :pugs<feature>
^ [ <[a..d]>+ & <[b..e]>+ ] $ bcd y conjunction (&)
# todo :pugs<feature>
<[a..c]>+ & <[b..e]>+ bcd y conjunction (&)
# todo :pugs<feature>
<[a..d]>+ & <[c..e]>+ bcd y conjunction (&)
b& bcd /rule error/ conjunction (&) - null right arg illegal
&b bcd /rule error/ conjunction (&) - null left arg illegal
& bcd /rule error/ conjunction (&) - null both args illegal
\& & y conjunction (&) - literal must be escaped
& & /rule error/ conjunction (&) - literal must be escaped
# todo :pge<leading |>
a&|b a&|b /rule error/ alternation and conjunction (&|) - parse error
a|&b a|&b /rule error/ alternation and conjunction (|&) - parse error
|d|b abc y leading alternation ignored
|d|b abc y leading alternation ignored
|d |b abc y leading alternation ignored
| d | b abc y leading alternation ignored
# todo :pugs<feature> :pge<feature>
b | | d abc n null pattern invalid
\pabc pabc /Obsolete/ retired metachars (\p)
\p{InConsonant} a /Obsolete/ retired metachars (\p)
\Pabc Pabc /Obsolete/ retired metachars (\P)
\P{InConsonant} a /Obsolete/ retired metachars (\P)
\Labc\E LabcE /Obsolete/ retired metachars (\L...\E)
\LABC\E abc /Obsolete/ retired metachars (\L...\E)
\Uabc\E UabcE /Obsolete/ retired metachars (\U...\E)
\Uabc\E ABC /Obsolete/ retired metachars (\U...\E)
\Qabc\E QabcE /Obsolete/ retired metachars (\Q...\E)
\Qabc d?\E abc d /Obsolete/ retired metachars (\Q...\E)
\Gabc Gabc /Obsolete/ retired metachars (\G)
\1abc 1abc /Obsolete/ retired metachars (\1)
# todo :pugs<feature>
^ \s+ $ \x0009\x0020\x00a0\x000a\x000b\x000c\x000d\x0085 y 0-255 whitespace (\s)
# todo :pugs<feature>
^ \h+ $ \x0009\x0020\x00a0 y 0-255 horizontal whitespace (\h)
^ \V+ $ \x0009\x0020\x00a0 y 0-255 horizontal whitespace (\V)
# todo :pugs<feature>
^ \v+ $ \x000a\x000b\x000c\x000d\x0085 y 0-255 vertical whitespace (\v)
^ \h+ $ \x000a\x000b\x000c\x000d\x0085 n 0-255 horizontal whitespace (\h)
^ \v+ $ \x0009\x0020\x00a0 n 0-255 vertical whitespace (\v)
# todo :pugs<feature>
^ \s+ $ \x1680\x180e\x2000\x2001\x2002\x2003\x2004\x2005\x2006\x2007\x2008\x2008\x2009\x200a\x202f\x205f\x3000 y unicode whitespace (\s)
# todo :pugs<feature>
^ \h+ $ \x1680\x180e\x2000\x2001\x2002\x2003\x2004\x2005\x2006\x2007\x2008\x2008\x2009\x200a\x202f\x205f\x3000 y unicode whitespace (\h)
^ \V+ $ \x1680\x180e\x2000\x2001\x2002\x2003\x2004\x2005\x2006\x2007\x2008\x2008\x2009\x200a\x202f\x205f\x3000 y unicode whitespace (\V)
^ \v+ $ \x1680\x180e\x2000\x2001\x2002\x2003\x2004\x2005\x2006\x2007\x2008\x2008\x2009\x200a\x202f\x205f\x3000 n unicode whitespace (\v)
c \t d abc\tdef y horizontal tab (\t)
c \t+ d abc\t\tdef y horizontal tab (\t)
a \t+ f abcdef n horizontal tab (\t)
b \t c abc\tdef n horizontal tab (\t)
\T a y not horizontal tab (\T)
a \T c abc y not horizontal tab (\T)
\T '' n not horizontal tab (\T)
c \T d abc\tdef n not horizontal tab (\T)
c \T+ d abc\t\tdef n not horizontal tab (\T)
a \T+ f abcdef y not horizontal tab (\T)
c \r d abc\rdef y return (\r)
c \r+ d abc\r\rdef y return (\r)
a \r+ f abcdef n return (\r)
b \r c abc\rdef n return (\r)
\R a y not return (\R)
a \R c abc y not return (\R)
\R '' n not return (\R)
c \R d abc\rdef n not return (\R)
c \R+ d abc\r\rdef n not return (\R)
a \R+ f abcdef y not return (\R)
c \f d abc\fdef y formfeed (\f)
c \f+ d abc\f\fdef y formfeed (\f)
a \f+ f abcdef n formfeed (\f)
b \f c abc\fdef n formfeed (\f)
\F a y not formfeed (\F)
a \F c abc y not formfeed (\F)
\F '' n not formfeed (\F)
c \F d abc\fdef n not formfeed (\F)
c \F+ d abc\f\fdef n not formfeed (\F)
a \F+ f abcdef y not formfeed (\F)
# todo :pugs<feature>
c \e d abc\edef y escape (\e)
# todo :pugs<feature>
c \e+ d abc\e\edef y escape (\e)
a \e+ f abcdef n escape (\e)
b \e c abc\edef n escape (\e)
\E a y not escape (\E)
a \E c abc y not escape (\E)
\E '' n not escape (\E)
# todo :pugs<feature>
c \E d abc\edef n not escape (\E)
# todo :pugs<feature>
c \E+ d abc\e\edef n not escape (\E)
a \E+ f abcdef y not escape (\E)
c \x0021 d abc!def y hex (\x)
c \x0021+ d abc!!def y hex (\x)
a \x0021+ f abcdef n hex (\x)
b \x0021 c abc!def n hex (\x)
c \x[0021] d abc!def y hex (\x[])
c \x[0021]+ d abc!!def y hex (\x[])
c \x[21,21] d abc!!def y hex (\x[])
c \x[21, 21] d abc!!def y hex (\x[])
c \x[ 21 , 21 ] d abc!!def y hex (\x[])
a \x[0021]+ f abcdef n hex (\x[])
b \x[0021] c abc!def n hex (\x[])
\X0021 a y not hex (\X)
a \X0021 c abc y not hex (\X)
\X0021 '' n not hex (\X)
c \X0021 d abc!def n not hex (\X)
c \X0021+ d abc!!def n not hex (\X)
a \X0021+ f abcdef y not hex (\X)
\X[0021] a y not hex (\X[])
a \X[0021] c abc y not hex (\X[])
\X[0021] '' n not hex (\X[])
c \X[0021] d abc!def n not hex (\X[])
c \X[0021]+ d abc!!def n not hex (\X[])
a \X[0021]+ f abcdef y not hex (\X[])
c \c33 d abc!def y hex (\c)
c \c33+ d abc!!def y hex (\c)
a \c33+ f abcdef n hex (\c)
b \c33 c abc!def n hex (\c)
c \c[33] d abc!def y hex (\c[])
c \c[33]+ d abc!!def y hex (\c[])
c \c[33,33] d abc!!def y hex (\c[])
c \c[ 33, 33] d abc!!def y hex (\c[])
c \c[ 33 , 33 ] d abc!!def y hex (\c[])
a \c[33]+ f abcdef n hex (\c[])
b \c[33] c abc!def n hex (\c[])
\C33 a y not hex (\C)
a \C33 c abc y not hex (\C)
\C33 '' n not hex (\C)
c \C33 d abc!def n not hex (\C)
c \C33+ d abc!!def n not hex (\C)
a \C33+ f abcdef y not hex (\C)
\C[33] a y not hex (\C[])
a \C[33] c abc y not hex (\C[])
\C[33] '' n not hex (\C[])
c \C[33] d abc!def n not hex (\C[])
c \C[33]+ d abc!!def n not hex (\C[])
a \C[33]+ f abcdef y not hex (\C[])
c \o041 d abc!def y octal (\o)
c \o41+ d abc!!def y octal (\o)
a \o41+ f abcdef n octal (\o)
b \o41 c abc!def n octal (\o)
c \o[41] d abc!def y octal (\o[])
c \o[41]+ d abc!!def y octal (\o[])
# todo :pugs<feature>
c \o[41,41] d abc!!def y octal (\o[])
a \o[41]+ f abcdef n octal (\o[])
b \o[41] c abc!def n octal (\o[])
\O41 a y not octal (\O)
a \O41 c abc y not octal (\O)
\O41 '' n not octal (\O)
c \O41 d abc!def n not octal (\O)
c \O41+ d abc!!def n not octal (\O)
a \O41+ f abcdef y not octal (\O)
\O[41] a y not octal (\O[])
a \O[41] c abc y not octal (\O[])
\O[41] '' n not octal (\O[])
c \O[41] d abc!def n not octal (\O[])
c \O[41]+ d abc!!def n not octal (\O[])
a \O[41]+ f abcdef y not octal (\O[])
a\w+f a=[ *f n word character
a\w+f abcdef y word character
a\W+f a&%- f y not word character
a\W+f abcdef n not word character
a\d+f abcdef n digit
ab\d+cdef ab42cdef y digit
a\D+f abcdef y not digit
a\D+f ab0cdef n not digit
## vim: noexpandtab tabstop=4 shiftwidth=4