1:
2:
3:
4:
5:
6:
7: (use gauche.test)
8: (use srfi-1)
9:
10: (test-start "regexp")
11:
12:
13:
14:
15: (define (match&list rx input)
16: (cond ((rxmatch rx input)
17: => (lambda (match)
18: (map (lambda (n) (rxmatch-substring match n))
19: (iota (rxmatch-num-matches match)))))
20: (else #f)))
21:
22:
23: (test-section "regexp-parse")
24:
25: (define-syntax test-regexp-parse
26: (syntax-rules ()
27: ((_ re ast)
28: (test* #`"regexp-parse \",re\"" ast (regexp-parse re)))))
29:
30: (test-regexp-parse "a" '(0 #f #\a))
31: (test-regexp-parse "ab" '(0 #f #\a #\b))
32: (test-regexp-parse "(?:ab)" '(0 #f (seq #\a #\b)))
33: (test-regexp-parse "(a)" '(0 #f (1 #f #\a)))
34: (test-regexp-parse "a?" '(0 #f (rep 0 1 #\a)))
35: (test-regexp-parse "a*" '(0 #f (rep 0 #f #\a)))
36: (test-regexp-parse "a+" '(0 #f (rep 1 #f #\a)))
37: (test-regexp-parse "a{3,5}" '(0 #f (rep 3 5 #\a)))
38: (test-regexp-parse "a{3}" '(0 #f (rep 3 3 #\a)))
39: (test-regexp-parse "a|b" '(0 #f (alt #\a #\b)))
40: (test-regexp-parse "[ab]" '(0 #f #[ab]))
41: (test-regexp-parse "[^ab]" '(0 #f (comp . #[ab])))
42: (test-regexp-parse "." '(0 #f any))
43: (test-regexp-parse "^" '(0 #f bol))
44: (test-regexp-parse "$" '(0 #f eol))
45: (test-regexp-parse "\\b" '(0 #f wb))
46: (test-regexp-parse "\\B" '(0 #f nwb))
47: (test-regexp-parse "(?>a)" '(0 #f (once #\a)))
48: (test-regexp-parse "a*+" '(0 #f (once (rep 0 #f #\a))))
49: (test-regexp-parse "a++" '(0 #f (once (rep 1 #f #\a))))
50: (test-regexp-parse "a?+" '(0 #f (once (rep 0 1 #\a))))
51: (test-regexp-parse "(?i:a)" '(0 #f (seq-uncase #\a)))
52: (test-regexp-parse "(?-i:a)" '(0 #f (seq-case #\a)))
53: (test-regexp-parse "(?=a)" '(0 #f (assert #\a)))
54: (test-regexp-parse "(?!a)" '(0 #f (nassert #\a)))
55: (test-regexp-parse "(?<=ab)" '(0 #f (assert (lookbehind #\a #\b))))
56: (test-regexp-parse "(?<!ab)" '(0 #f (nassert (lookbehind #\a #\b))))
57: (test-regexp-parse "(?<name>a)" '(0 #f (1 name #\a)))
58: (test-regexp-parse "(?(?=)y)" '(0 #f (cpat (assert) (#\y) #f)))
59: (test-regexp-parse "(?(?=)y|n)" '(0 #f (cpat (assert) (#\y) (#\n))))
60: (test-regexp-parse "(?(?<=)y)" '(0 #f (cpat (assert (lookbehind)) (#\y) #f)))
61: (test-regexp-parse "(?(?<=)y|n)" '(0 #f (cpat (assert (lookbehind)) (#\y) (#\n))))
62: (test-regexp-parse "()(?(1)y)" '(0 #f (1 #f) (cpat 1 (#\y) #f)))
63: (test-regexp-parse "()(?(1)y|n)"'(0 #f (1 #f) (cpat 1 (#\y) (#\n))))
64: (test-regexp-parse "()\\1" '(0 #f (1 #f) (backref . 1)))
65: (test-regexp-parse "(?<name>)\\k<name>" '(0 #f (1 name) (backref . 1)))
66: (test-regexp-parse "(?<name>)(?<name>)\\k<name>"
67: '(0 #f (1 name) (2 name) (alt (backref . 2) (backref . 1))))
68:
69:
70: (test-section "compile")
71:
72: (define-syntax test-regexp-compile
73: (syntax-rules ()
74: ((_ pat)
75: (test* #`"regexp-compile \",|pat|\"" #t
76: (regexp? (regexp-compile (regexp-parse pat)))))))
77:
78: (test-regexp-compile "a")
79: (test-regexp-compile "ab")
80: (test-regexp-compile "(?:ab)")
81: (test-regexp-compile "(a)")
82: (test-regexp-compile "a?")
83: (test-regexp-compile "a*")
84: (test-regexp-compile "a+")
85: (test-regexp-compile "a{3,5}")
86: (test-regexp-compile "a{3}")
87: (test-regexp-compile "a|b")
88: (test-regexp-compile "[ab]")
89: (test-regexp-compile "[^ab]")
90: (test-regexp-compile ".")
91: (test-regexp-compile "^")
92: (test-regexp-compile "$")
93: (test-regexp-compile "\\b")
94: (test-regexp-compile "\\B")
95: (test-regexp-compile "(?>a)")
96: (test-regexp-compile "a*+")
97: (test-regexp-compile "a++")
98: (test-regexp-compile "a?+")
99: (test-regexp-compile "(?i:a)")
100: (test-regexp-compile "(?-i:a)")
101: (test-regexp-compile "(?=a)")
102: (test-regexp-compile "(?!a)")
103: (test-regexp-compile "(?<=ab)")
104: (test-regexp-compile "(?<!ab)")
105: (test-regexp-compile "(?<name>a)")
106: (test-regexp-compile "(?(?=)y)")
107: (test-regexp-compile "(?(?=)y|n)")
108: (test-regexp-compile "(?(?<=)y)")
109: (test-regexp-compile "(?(?<=)y|n)")
110: (test-regexp-compile "()(?(1)y)")
111: (test-regexp-compile "()(?(1)y|n)")
112: (test-regexp-compile "()\\1")
113: (test-regexp-compile "(?<name>)\\k<name>")
114: (test-regexp-compile "(?<name>)(?<name>)\\k<name>")
115:
116:
117: (test-section "basics")
118:
119: (test* "a" '("a")
120: (match&list #/a/ "a"))
121: (test* "a" #f
122: (match&list #/a/ "A"))
123: (test* "a" '("a")
124: (match&list #/a/ "ba"))
125: (test* "a" '("a")
126: (match&list #/a/ "bac"))
127: (test* "a" #f
128: (match&list #/a/ ""))
129: (test* "a" '("a")
130: (match&list #/a/ (string (integer->char 0) #\a #\b)))
131: (test* "abc" '("abc")
132: (match&list #/abc/ "abc"))
133: (test* "abc" #f
134: (match&list #/abc/ "abbc"))
135: (test* "abc" '("abc")
136: (match&list #/abc/ "babcd"))
137: (test* "abc|de" '("abc")
138: (match&list #/abc|de/ "dabce"))
139: (test* "abc|de" '("de")
140: (match&list #/abc|de/ "abdec"))
141: (test* "abc|de" #f
142: (match&list #/abc|de/ "abe"))
143: (test* "a|b|c" '("a")
144: (match&list #/a|b|c/ "abc"))
145: (test* "a|b|c" '("b")
146: (match&list #/a|b|c/ "bac"))
147: (test* "a|b|c" #f
148: (match&list #/a|b|c/ "def"))
149: (test* "|abc" '("")
150: (match&list #/|abc/ "abc"))
151: (test* "abc|" '("abc")
152: (match&list #/abc|/ "abc"))
153: (test* "abc|" '("")
154: (match&list #/abc|/ "abd"))
155:
156:
157: (test-section "parens")
158:
159: (test* "a(b)c" '("abc" "b")
160: (match&list #/a(b)c/ "abc"))
161: (test* "a((b)(c))" '("abc" "bc" "b" "c")
162: (match&list #/a((b)(c))/ "abc"))
163: (test* "a((((b))))c" '("abc" "b" "b" "b" "b")
164: (match&list #/a((((b))))c/ "abc"))
165: (test* "a((((b))))c" '#f
166: (match&list #/a((((b))))c/ "a(b)c"))
167: (test* "a\\(" '("a(")
168: (match&list #/a\(/ "a("))
169: (test* "a()b" '("ab" "")
170: (match&list #/a()b/ "ab"))
171: (test* "a()()b" '("ab" "" "")
172: (match&list #/a()()b/ "ab"))
173: (test* "(we|wee|week|frob)(knights|night|day)"
174: '("weeknights" "wee" "knights")
175: (match&list #/(we|wee|week|frob)(knights|night|day)/
176: "weeknights"))
177: (test* "aa|(bb)|cc" '("aa" #f)
178: (match&list #/aa|(bb)|cc/ "aabb"))
179: (test* "aa|(bb)|cc" '("bb" "bb")
180: (match&list #/aa|(bb)|cc/ "abbaa"))
181: (test* "aa|(bb)|cc" '("cc" #f)
182: (match&list #/aa|(bb)|cc/ "bccaa"))
183: (test* "aa|a(b)|cc" '("ab" "b")
184: (match&list #/aa|a(b)|cc/ "abaab"))
185: (test* "aa|a(b)" '("ab" "b")
186: (match&list #/aa|a(b)/ "abaab"))
187: (test* "aa|(a(b))|ac" '("ab" "ab" "b")
188: (match&list #/aa|(a(b))|cc/ "abaabcc"))
189: (test* "(ab)|ac" '("ab" "ab")
190: (match&list #/(ab)|ac/ "aaaabcc"))
191: (test* "(a(b))|ac" '("ab" "ab" "b")
192: (match&list #/(a(b))|ac/ "abaabcc"))
193: (test* "ab|(ac)" '("ab" #f)
194: (match&list #/ab|(ac)/ "aaaabcc"))
195: (test* "ab|(ac)" '("ac" "ac")
196: (match&list #/ab|(ac)/ "aaaacbc"))
197: (test* "aa|(ab|(ac))|ad" '("ac" "ac" "ac")
198: (match&list #/aa|(ab|(ac))|ad/ "cac"))
199: (test* "(aa|(a(b)|a(c))|ad)" '("ac" "ac" "ac" #f "c")
200: (match&list #/(aa|(a(b)|a(c))|ad)/ "cac"))
201: (test* "(.)*" '("abc" "c")
202: (match&list #/(.)*/ "abc"))
203: (test* "(a([^a])*)*" '("abcaBC" "aBC" "C")
204: (match&list #/(a([^a])*)*/ "abcaBC"))
205: (test* "b|()|a" '("" "")
206: (match&list #/b|()|a/ "cac"))
207:
208:
209: (test-section "simple meta")
210:
211: (test* "a.c" '("abc")
212: (match&list #/a.c/ "abc"))
213: (test* "a.." '("abc")
214: (match&list #/a../ "abc"))
215: (test* "a.." #f
216: (match&list #/a../ "ab"))
217: (test* "..." #f
218: (match&list #/.../ "ab"))
219: (test* "." '("a")
220: (match&list #/./ "abc"))
221: (test* "." #f
222: (match&list #/./ ""))
223:
224:
225: (test-section "anchors")
226:
227: (test* "^abc" '("abc")
228: (match&list #/^abc/ "abcd"))
229: (test* "^abc" #f
230: (match&list #/^abc/ "aabcd"))
231: (test* "^^" '("^")
232: (match&list #/^^/ "^^abc"))
233: (test* "^^" #f
234: (match&list #/^^/ "a^^c"))
235: (test* "^abc|def" '("abc")
236: (match&list #/^abc|def/ "abc"))
237: (test* "^abc|def" #f
238: (match&list #/^abc|def/ "zabc"))
239: (test* "^abc|def" '("def")
240: (match&list #/^abc|def/ "zabcdef"))
241: (test* "abc|^def" '("def")
242: (match&list #/abc|^def/ "defabc"))
243: (test* "abc|^def" '("abc")
244: (match&list #/abc|^def/ "abcdef"))
245: (test* "abc|^def" '("def")
246: (match&list #/abc|^def/ "defabbc"))
247: (test* "abc|^def" #f
248: (match&list #/abc|^def/ "adefbc"))
249: (test* "^(abc|def)" '("abc" "abc")
250: (match&list #/^(abc|def)/ "abc"))
251: (test* "^(abc|def)" #f
252: (match&list #/^(abc|def)/ "aabc"))
253: (test* "(^abc|def)" '("abc" "abc")
254: (match&list #/(^abc|def)/ "abcdef"))
255: (test* "(^abc|def)" '("def" "def")
256: (match&list #/(^abc|def)/ "^abcdef"))
257: (test* "a(^bc|def)" '("a^bc" "^bc")
258: (match&list #/a(^bc|def)/ "a^bcdef"))
259: (test* "a(^bc|def)" #f
260: (match&list #/a(^bc|def)/ "abcdef"))
261: (test* "^" '("")
262: (match&list #/^/ "hoge"))
263: (test* "$" '("")
264: (match&list #/$/ "hoge"))
265: (test* "abc$" '("abc")
266: (match&list #/abc$/ "bcabc"))
267: (test* "abc$" #f
268: (match&list #/abc$/ "abcab"))
269: (test* "^abc$" '("abc")
270: (match&list #/^abc$/ "abc"))
271: (test* "abc$$" #f
272: (match&list #/abc$$/ "abc"))
273: (test* "abc$$" '("abc$")
274: (match&list #/abc$$/ "abc$"))
275: (test* "$$" '("$")
276: (match&list #/$$/ "abc$"))
277: (test* "^$" '("")
278: (match&list #/^$/ ""))
279: (test* "^$" #f
280: (match&list #/^$/ "a"))
281: (test* "^^$$" '("^$")
282: (match&list #/^^$$/ "^$"))
283: (test* "abc$|def" '("abc")
284: (match&list #/abc$|def/ "abc"))
285: (test* "abc$|def" '("def")
286: (match&list #/abc$|def/ "defabc"))
287: (test* "^abc|def$" '("abc")
288: (match&list #/^abc|def$/ "abcdef"))
289: (test* "^abc|def$" #f
290: (match&list #/^abc|def$/ "defabc"))
291: (test* "^abc|def$" #f
292: (match&list #/^abc|def$/ "defabc"))
293: (test* "(^abc|def$)" '("def" "def")
294: (match&list #/(^abc|def$)/ "aaadef"))
295: (test* "(^abc|def$)$" #f
296: (match&list #/(^abc|def$)$/ "aaadef"))
297: (test* "(^abc|def$)$" '("def$" "def$")
298: (match&list #/(^abc|def$)$/ "aaadef$"))
299: (test* "(abc$|def)$" #f
300: (match&list #/(abc$|def)$/ "aaabc"))
301: (test* "(abc$|def)$" '("abc$" "abc$")
302: (match&list #/(abc$|def)$/ "aaabc$"))
303: (test* "a$b" '("a$b")
304: (match&list #/a$b/ "aa$bb"))
305: (test* "ab\\$" '("ab$")
306: (match&list #/ab\$/ "ab$cd"))
307:
308:
309: (test-section "backslash escape")
310:
311: (test* "a\\*c" '("a*c")
312: (match&list #/a\*c/ "a*c"))
313: (test* "a\\.c" '("a.c")
314: (match&list #/a\.c/ "a.c"))
315: (test* "a\\.c" #f
316: (match&list #/a\.c/ "abc"))
317: (test* "a\\\\b" '("a\\b")
318: (match&list #/a\\b/ "a\\b"))
319: (test* "a\\\\\\*b" '("a\\*b")
320: (match&list #/a\\\*b/ "a\\*b"))
321: (test* "a\\jc" '("ajc")
322: (match&list #/a\jc/ "ajc"))
323: (test* "a\\\\bc" '("a\\bc")
324: (match&list #/a\\bc/ "a\\bc"))
325: (test* "a\\[b" '("a[b")
326: (match&list #/a\[b/ "a[b"))
327:
328:
329: (test-section "word boundary")
330:
331: (test* ".z\\b" '("oz")
332: (match&list #/.z\b/ "bzbazoz ize"))
333: (test* "\\b.z" '("iz")
334: (match&list #/\b.z/ "brzbazoz ize"))
335: (test* ".z\\B" '("iz")
336: (match&list #/.z\B/ "bz baz oz ize"))
337: (test* "\\B.z" '("az")
338: (match&list #/\B.z/ "bz baz oz ize"))
339:
340:
341: (test-section "repetitions")
342:
343: (test* "ab*c" '("abc")
344: (match&list #/ab*c/ "abc"))
345: (test* "ab*c" '("ac")
346: (match&list #/ab*c/ "ac"))
347: (test* "ab*c" '("abbbc")
348: (match&list #/ab*c/ "abbbc"))
349: (test* "ab*c" '("abbc")
350: (match&list #/ab*c/ "abbabaabbc"))
351: (test* "ab+c" '("abc")
352: (match&list #/ab+c/ "abc"))
353: (test* "ab+c" '("abbc")
354: (match&list #/ab+c/ "abbc"))
355: (test* "ab+c" '("abbc")
356: (match&list #/ab+c/ "abbabaabbc"))
357: (test* "ab?c" '("abc")
358: (match&list #/ab?c/ "abc"))
359: (test* "ab?c" '("ac")
360: (match&list #/ab?c/ "abbaac"))
361: (test* "a.*c" '("abc")
362: (match&list #/a.*c/ "abc"))
363: (test* "a.*c" '("aabcabcabcabcc")
364: (match&list #/a.*c/ "zaabcabcabcabcczab"))
365: (test* "a(b*|c)d" '("abbd" "bb")
366: (match&list #/a(b*|c)d/ "abbd"))
367: (test* "a(b*|c)d" '("ad" "")
368: (match&list #/a(b*|c)d/ "ad"))
369: (test* "a(b*|c)d" '("acd" "c")
370: (match&list #/a(b*|c)d/ "acd"))
371: (test* "a(b*|c)d" #f
372: (match&list #/a(b*|c)d/ "abcd"))
373: (test* "a.*c" '("ac")
374: (match&list #/a.*c/ "bacbababbbbadbaba"))
375: (test* "a.*c" #f
376: (match&list #/a.*c/ "abaaaabababbadbabdba"))
377:
378:
379: (test-section "repetitions (non-greedy)")
380:
381: (test* "ab*?." '("ab")
382: (match&list #/ab*?./ "abc"))
383: (test* "ab*?." '("ac")
384: (match&list #/ab*?./ "ac"))
385: (test* "a.*?c" '("abbbc")
386: (match&list #/a.*?c/ "abbbc"))
387: (test* "a.*?a" '("abba")
388: (match&list #/a.*?a/ "abbabaabbc"))
389: (test* "<.*?>" '("<tag1>")
390: (match&list #/<.*?>/ "<tag1><tag2><tag3>"))
391:
392: (test* "ab+?." '("abc")
393: (match&list #/ab+?./ "abc"))
394: (test* "ab+?." '("abb")
395: (match&list #/ab+?./ "abbc"))
396: (test* "a.+?a" '("abba")
397: (match&list #/a.+?a/ "abbabaabbc"))
398: (test* "<.+?>" '("<><tag1>")
399: (match&list #/<.+?>/ " <><tag1><tag2>"))
400:
401: (test* "ab??c" '("abc")
402: (match&list #/ab??c/ "abc"))
403: (test* "ab??c" '("ac")
404: (match&list #/ab??c/ "abbaac"))
405: (test* "ab??." '("ab")
406: (match&list #/ab??./ "abbaac"))
407: (test* "a(hoge)??hoge" '("ahoge" #f)
408: (match&list #/a(hoge)??hoge/ "ahogehoge"))
409: (test* "(foo)??bar" '("foobar" "foo")
410: (match&list #/(foo)??bar/ "foobar"))
411: (test* "(foo)??bar" '("foobar" "foo")
412: (match&list #/(foo)??bar/ "foofoobar"))
413: (test* "(foo)*?bar" '("foofoobar" "foo")
414: (match&list #/(foo)*?bar/ "foofoobar"))
415:
416:
417: (test-section "character class")
418:
419: (test* "a[bc]d" '("abd")
420: (match&list #/a[bc]d/ "abd"))
421: (test* "a[bc]d" '("acd")
422: (match&list #/a[bc]d/ "acd"))
423: (test* "a[bc]d" #f
424: (match&list #/a[bc]d/ "aed"))
425: (test* "a[a-z]d" '("aed")
426: (match&list #/a[a-z]d/ "aed"))
427: (test* "a[a-z]d" #f
428: (match&list #/a[a-z]d/ "aEd"))
429: (test* "a[]]d" '("a]d")
430: (match&list #/a[]]d/ "a]d"))
431: (test* "a[]-]d" '("a-d")
432: (match&list #/a[]-]d/ "a-d"))
433: (test* "a[]-^]d" #f
434: (match&list #/a[]-^]d/ "a-d"))
435: (test* "a[]-^]d" '("a]d")
436: (match&list #/a[]-^]d/ "a]d"))
437: (test* "a[a-z-]d" '("a-d")
438: (match&list #/a[a-z-]d/ "a-d"))
439: (test* "a[a-z-]d" '("afd")
440: (match&list #/a[a-z-]d/ "afd"))
441: (test* "a[az-]d" '("a-d")
442: (match&list #/a[az-]d/ "a-d"))
443: (test* "a[a-]d" '("a-d")
444: (match&list #/a[a-]d/ "a-d"))
445: (test* "a[az-]d" #f
446: (match&list #/a[az-]d/ "afd"))
447: (test* "a[az-]d" '("azd")
448: (match&list #/a[az-]d/ "azd"))
449: (test* "a[^ab]c" '("acc")
450: (match&list #/a[^ab]c/ "abacc"))
451: (test* "a[^]]c" '("abc")
452: (match&list #/a[^]]c/ "abc"))
453: (test* "a[^]]c" #f
454: (match&list #/a[^]]c/ "a]c"))
455: (test* "a[^^]c" '("abc")
456: (match&list #/a[^^]c/ "abc"))
457: (test* "a[^^]c" #f
458: (match&list #/a[^^]c/ "a^c"))
459: (test* "a[Bc]*d" '("aBccBd")
460: (match&list #/a[Bc]*d/ "aBccBd"))
461: (test* "[a]b[c]" '("abc")
462: (match&list #/[a]b[c]/ "abc"))
463: (test* "[abc]b[abc]" '("abc")
464: (match&list #/[abc]b[abc]/ "abc"))
465: (test* "a[bc]d" '("abd")
466: (match&list #/a[bc]d/ "xyzaaabcaababdacd"))
467: (test* "a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night)"
468: '("aaaaabaaaabaaaabaaaabweeknights" "wee" "knights")
469: (match&list #/a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night)/
470: "aaaaabaaaabaaaabaaaabweeknights"))
471: (test* "[ab][cd][ef][gh][ij][kl][mn]"
472: '("acegikm")
473: (match&list #/[ab][cd][ef][gh][ij][kl][mn]/
474: "xacegikmoq"))
475: (test* "[ab][cd][ef][gh][ij][kl][mn][op]"
476: '("acegikmo")
477: (match&list #/[ab][cd][ef][gh][ij][kl][mn][op]/
478: "xacegikmoq"))
479: (test* "[ab][cd][ef][gh][ij][kl][mn][op][qr]"
480: '("acegikmoq")
481: (match&list #/[ab][cd][ef][gh][ij][kl][mn][op][qr]/
482: "xacegikmoqy"))
483: (test* "[ab][cd][ef][gh][ij][kl][mn][op][q]"
484: '("acegikmoq")
485: (match&list #/[ab][cd][ef][gh][ij][kl][mn][op][q]/
486: "xacegikmoqy"))
487:
488:
489: (test* "[^a]*." '("b")
490: (match&list #/[^a]*./ "b"))
491:
492: (test* "\\s" '(" ") (match&list #/\s/ " "))
493: (test* "\\s" '(" ") (match&list #/\s\s/ " "))
494: (test* "\\s" '("\t") (match&list #/\s/ "\t "))
495: (test* "\\s" #f (match&list #/\s\s/ "\\s"))
496: (test* "\\\\s" '("\\s ") (match&list #/\\s\s/ "\\s "))
497: (test* "\\s\\S" '("\txyz " "\t" "xyz" " ")
498: (match&list #/(\s*)(\S+)(\s*)/ "\txyz abc"))
499: (test* "\\d\\D" '("1234) 5678-9012" "1234" ") " "5678" "-" "9012")
500: (match&list #/(\d+)(\D+)(\d+)(\D+)(\d+)/
501: " (1234) 5678-9012 "))
502: (test* "\\w\\W" '("three o" "three" " " "o")
503: (match&list #/(\w+)(\W+)(\w+)/
504: "three o'clock"))
505:
506: (test* "[ab\\sc]+" '(" ba ") (match&list #/[ab\sc]+/ "d ba e"))
507: (test* "[\\sa-c]+" '(" ba ") (match&list #/[\sabc]+/ "d ba e"))
508: (test* "[\\S\\t]+" '("\tab") (match&list #/[\S\t]+/ "\tab cd"))
509: (test* "[\\s\\d]+" '(" 1 2 3 ")
510: (match&