shithub: mc

ref: ac3d02cdfbafe7b887cbd8738d3df9b17c5c82c9
dir: /libregex/test/basic.myr/

View raw version
use std

use "testmatch.use"

const main = {
	var s : byte[:]
		
	s = std.strjoin([
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
	][:], "")
	testmatch(".*bc", "Abc")
	testmatch("(a*)*", "a")
	testmatch("(aa|aab?)*", s)
        /* greedy matches */
        testmatch("(<.*>).*", "<a foo> blah <bar>")
        testmatch("(<.+>).*", "<a foo> blah <bar>")
        /* reluctant matches */
        testmatch("(<.*?>).*", "<a foo> blah <bar>")
        testmatch("(<.+?>).*", "<a foo> blah <bar>")
}