From f4fe18ed4958561d17625991e297a6f79017446d Mon Sep 17 00:00:00 2001 From: ge Date: Mon, 13 Jan 2025 20:54:32 +0300 Subject: [PATCH] fix example --- examples/parse_units.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/parse_units.v b/examples/parse_units.v index 714cf3d..a2acff8 100644 --- a/examples/parse_units.v +++ b/examples/parse_units.v @@ -18,8 +18,8 @@ fn (m Memory) mib() f64 { fn Memory.from_string(s string) !Memory { mut re := regex.regex_opt(r'^(\d+)([a-zA-Z]+)$')! re.match_string(s) - if re.groups.len < 2 { - return error('unable to parse string ${s}') + if re.groups.len != 2 { + return error("unable to parse string '${s}'") } value := re.get_group_by_id(s, 0).f64() unit := dataunits.from_string(re.get_group_by_id(s, 1))!