diff --git a/examples/colorful/colorful.tm b/examples/colorful/colorful.tm index 7b265ec..78a831c 100644 --- a/examples/colorful/colorful.tm +++ b/examples/colorful/colorful.tm @@ -171,7 +171,7 @@ func _add_ansi_sequences(text:Text, prev_state:_TermState -> Text): else if text == "rparen": return ")" else if text == "@" or text == "at": return "@" parts := ( - text:matches_pattern($Pat/{0+..}:{0+..}/) or + text:pattern_captures($Pat/{0+..}:{0+..}/) or return "@("++_for_terminal(Colorful.from_text(text), prev_state)++")" ) attributes := parts[1]:split_pattern($Pat/{0+space},{0+space}/) diff --git a/examples/tomo-install/tomo-install.tm b/examples/tomo-install/tomo-install.tm index 3be23a8..e584fe6 100644 --- a/examples/tomo-install/tomo-install.tm +++ b/examples/tomo-install/tomo-install.tm @@ -17,8 +17,8 @@ func find_urls(path:Path -> [Text]): urls:insert_all(find_urls(f)) else if path:is_file() and path:extension() == ".tm": for line in path:by_line()!: - if m := line:matches_pattern($Pat/use{space}{url}/) or line:matches_pattern($Pat/{id}{space}:={space}use{space}{url}/): - urls:insert(m[-1]) + if captures := line:pattern_captures($Pat/use{space}{url}/) or line:pattern_captures($Pat/{id}{space}:={space}use{space}{url}/): + urls:insert(captures[-1]) return urls func main(paths:[Path]): @@ -42,7 +42,7 @@ func main(paths:[Path]): alias := none:Text curl_flags := ["-L"] - if github := url_without_protocol:matches_pattern($Pat"github.com/{!/}/{!/}#{..}"): + if github := url_without_protocol:pattern_captures($Pat"github.com/{!/}/{!/}#{..}"): user := github[1] repo := github[2] tag := github[3]