summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Type/_hosts5
1 files changed, 3 insertions, 2 deletions
diff --git a/Completion/Unix/Type/_hosts b/Completion/Unix/Type/_hosts
index 56540865e..d9e1090a4 100644
--- a/Completion/Unix/Type/_hosts
+++ b/Completion/Unix/Type/_hosts
@@ -50,12 +50,13 @@ if ! zstyle -a ":completion:${curcontext}:hosts" hosts _hosts; then
         # entries.
         () {
           local host
+          local -a match mbegin mend
           khosts=()
           for host; do
             if [[ $host == *[*?]* ]]; then
               continue
-            elif [[ $host =~ "\[(.*)\]:\d*" ]]; then
-              khosts+=$match
+            elif [[ $host = (#b)*\[(*)\]:[[:digit:]]#* ]]; then
+              khosts+=${match[1]}
             else
               khosts+=$host
             fi