On Jan 15, 2016, at 2:47 AM, David Malcolm <dmalc...@redhat.com> wrote: > FWIW, I do something similar in multiline.exp's _build_multiline_regex, > which attempts to have a complete list of metacharacters (though I > believe some of these are not valid for POSIX filenames);
Only ‘\’ and ‘\0’ are invalid. The rest are ok. ‘/‘ is only invalid in a single component of a path, because / is used as a separator. > # We need to escape "^" and other regexp metacharacters. > set line [string map {"^" "\\^" > "(" "\\(" > ")" "\\)" > "[" "\\[" > "]" "\\]" > "{" "\\{" > "}" "\\}" > "." "\\." > "\\" "\\\\" > "?" "\\?" > "+" "\\+" > "*" "\\*" > "|" "\\|"} $line] Some regexp systems that use ^, also use $. TCL does does example.