tramp-file-name-structure

tramp-file-name-structure is a variable defined in `tramp.el'.
Its value is

("^/\\(\\(?:\\(?:\\([a-zA-Z_0-9-]+\\):\\)?\\(?:\\([^/|: ]+\\)@\\)?\\(\\(?:[a-zA-Z0-9_.-]+\\|\\[\\(?:\\(?:\\(?:[a-zA-Z0-9]+\\)?:\\)+[a-zA-Z0-9.]+\\)?]\\)\\(?:#[0-9]+\\)?\\)?|\\)+\\)?\\(?:\\([a-zA-Z_0-9-]+\\):\\)?\\(?:\\([^/|: ]+\\)@\\)?\\(\\(?:[a-zA-Z0-9_.-]+\\|\\[\\(?:\\(?:\\(?:[a-zA-Z0-9]+\\)?:\\)+[a-zA-Z0-9.]+\\)?]\\)\\(?:#[0-9]+\\)?\\)?:\\(.*$\\)" 5 6 7 8 1)

  • This variable may be risky if used as a file-local variable.

Documentation:
List of six elements (REGEXP METHOD USER HOST FILE HOP), detailing the Tramp file name structure.

The first element REGEXP is a regular expression matching a Tramp file
name. The regex should contain parentheses around the method name,
the user name, the host name, and the file name parts.

The second element METHOD is a number, saying which pair of
parentheses matches the method name. The third element USER is
similar, but for the user name. The fourth element HOST is similar,
but for the host name. The fifth element FILE is for the file name.
The last element HOP is the ad-hoc hop definition, which could be a
cascade of several hops.

These numbers are passed directly to `match-string', which see. That
means the opening parentheses are counted to identify the pair.

See also `tramp-file-name-regexp'.