I'm trying in vain to write a regular expression to match valid ssh connection strings.
I really only need to recognise strings of the format:
- user@hostname:/some/path
but it would be nice to also match an implicit home directory:
- user@hostname:
I've so-far come up with this regex:
/^[:alnum:]+\@\:(\/[:alnum:]+)*$/
which doesn't work as intended.
Any suggestions welcome before my brain explodes and I start speaking in line noise :)