go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/lucicfg/testdata/misc/re.star (about) 1 load("@stdlib//internal/re.star", "re") 2 3 RE = r"^(([[:graph:]]+)/)?([[:graph:]]+)$" 4 5 def test(): 6 groups = re.submatches(RE, "abc/def") 7 assert.eq(groups[-2:], ("abc", "def")) 8 9 groups = re.submatches(RE, "abc") 10 assert.eq(groups[-2:], ("", "abc")) 11 12 groups = re.submatches(RE, "") 13 assert.true(not groups) 14 15 test()