shithub: mc

ref: 4da6b64bc65069fa1621aa8c1bf155cf8cc9b00a
dir: /bench/regex-match.myr/

View raw version
use std
use regex

const main = {
	var str, re, i

	str = "€i²æ&±-ŝ€i²æ&±-ŝ€i²æ&±-ŝ€i²æ&±-ŝ€i²æ&±-ŝüüü€i²æ&±-ŝüüü€i²æ&±-ŝü"
	str = std.strcat(str, str)
	str = std.strcat(str, str)
	str = std.strcat(str, str)
	str = std.strcat(str, str)

	for i = 0; i < 100; i++
		match regex.compile(".*")
		| `std.Ok r:	re = r
		| `std.Err m:	std.fatal("couldn't compile regex: %s\n", m)
		;;

		match regex.exec(re, str)
		| `std.Some m:
		| `std.None:	std.fatal("Didn't match regex\n")
		;;

		regex.free(re)
	;;
}