Files
mgmt/examples/lang/regexp0.mcl
James Shubin 43839d1090 all: Switch the --lang syntax to use argv instead
It was a bit awkward using `mgmt run lang --lang <input>` so instead, we
now drop the --lang, and read the positional argv for the input.

This also does the same for the --yaml frontend.
2019-05-05 11:10:47 -04:00

11 lines
385 B
Plaintext

import "fmt"
import "regexp"
# test with:
# ./mgmt run --hostname foo.example.com --tmp-prefix lang examples/lang/regexp0.mcl
# ./mgmt run --hostname db1.example.com --tmp-prefix lang examples/lang/regexp0.mcl
print "regexp" {
# TODO: add a heredoc string to avoid needing to escape the \ chars
msg => fmt.printf("match: %t", regexp.match("^db\\d+\\.example\\.com$", $hostname)),
}