Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using regex? #265

Open
adamgibbins opened this issue Oct 8, 2017 · 2 comments
Open

Using regex? #265

adamgibbins opened this issue Oct 8, 2017 · 2 comments
Projects

Comments

@adamgibbins
Copy link

I'm trying to specify a host like so .*(one|two)\.foo\.com yet this isn't being matched, is only a small subset of regex supported? Or am I doing it wrong?

I'm finding validating config pretty tricky once you've loads of definitions, is there an easier way other than running ssh -v after building ssh_config? It'd be nice if there was some command you could pass a hostname and it'd spit out the config for.

I'm only using this regex as assh doesn't seem to support multiple host matches without a template - unlike normal ssh. e.g. I can't specify "*.one.foo.com" "*.two.foo.com":

@welchwilmerck
Copy link

The code uses path globbing - a minimal regex. That's a better match for the very limited globbing implemented in the config file parser in the typical ssh library that's going to read the generated config.

Use

Hosts:
  "*one.foo.com *two.foo.com":
      yoursshoption: x

to get

Host  *one.foo.com *two.foo.com
  yoursshoption: x

in the config.

@zanglang
Copy link

I think the issue here is that the README mentions regex a lot of times, which leads people to think they can do complex stuff like "(host(A|B|C)\d+" and so on. It might be useful to add a section to the page that just says it supports Go's path.Match and linked to https://golang.org/pkg/path/#Match

@moul moul added this to Triage in Kanban Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Kanban
  
Triage
Development

No branches or pull requests

3 participants