shithub: mc

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

View raw version
use "testmatch.use"

const main = {
	/* expected matches */
	testmatch("\\<([a-z]*)\\>", "abcdef")	/* whole word */
	testmatch(".*(\\<.*\\>).*", "!m!")	/* single char word in midstring */
	testmatch(".*(\\<.*\\>).*", "!m")	/* single char word at end of string */
	testmatch(".*(\\<.*\\>).*", "m!")	/* single char word at start of string */
	testmatch(".*(\\<.*\\>).*", "!@#!!matches!!%!")	/* word in midstring */
	testmatch(".*(\\<.*\\>).*", "matches!!%!")	/* word at start of string */
	testmatch(".*(\\<.*\\>).*", "!@#!!matches")	/* word at end of string */
	testmatch(".*(\\<.*\\>).*", "!@#!!matches!!%!foo")	/* matches last word in string */
	testmatch(".*(\\<.*\\>).*", "123")	/* numbers are also word bounds */
	
	/* nonmatches */
	testmatch("\\<([a-z]*)\\>foo", "abcdefoo")	/* word boundary needed in midstring */
}