diff --git a/bin/tools/foamCreateCompletionCache b/bin/tools/foamCreateCompletionCache
index 2bf5bac62540677b8935fca416677d4f5a4a2a25..4a8f56a144b8fc213f64057c387ae1f61cd5380d 100755
--- a/bin/tools/foamCreateCompletionCache
+++ b/bin/tools/foamCreateCompletionCache
@@ -133,14 +133,26 @@ HEADER
 
 #-------------------------------------------------------------------------------
 
-# Scans the output of the application -help to detect options with/without
+# Scans the output of the application -help-full to detect options with/without
 # arguments.  Dispatch via _of_complete_
 #
+# Extract all options of the format
+#   -opt1         descrip
+#   -opt2 <arg>   descrip
+#   -help-full
+# Terminate parsing on first appearance of -help-full
+# - options with '=' (eg, -mode=ugo) are not handled very well at all.
+# - alternatives (eg, -a, -all) are not handled nicely either,
+#   for these treat ',' like a space to catch the worst of them.
 extractOptions()
 {
     local appName="$1"
     local helpText=$($appName -help-full 2>/dev/null | \
-        sed -n -e 's/,/ /g' -e 's/=.*$/=/' -e '/^  *-/p')
+        sed -ne 's/^ *//; /^$/d; /^[^-]/d; /^--/d;' \
+            -e 'y/,/ /; s/=.*$/=/;' \
+            -e '/^-[^ ]* </{ s/^\(-[^ ]* <\).*$/\1/; p; d }' \
+            -e 's/^\(-[^ ]*\).*$/\1/; p; /^-help-full/q;' \
+            )
 
     [ -n "$helpText" ] || {
         echo "Error calling $appName" 1>&2
@@ -148,11 +160,11 @@ extractOptions()
     }
 
     # Array of options with args
-    local argOpts=($(awk '/^ {0,4}-[a-z]/ && /</ {print $1}' <<< "$helpText"))
+    local argOpts=($(awk '/</ {print $1}' <<< "$helpText"))
 
     # Array of options without args, but skip the following:
     #     -help-compat -help-full
-    local boolOpts=($(awk '/^ {0,4}-[a-z]/ && !/</ && !/help-(compat|full)/ {print $1}' <<< "$helpText"))
+    local boolOpts=($(awk '!/</ && !/help-(compat|full)/ {print $1}' <<< "$helpText"))
 
     appName="${appName##*/}"
     echo "$appName" 1>&2
diff --git a/etc/config.sh/bash_completion b/etc/config.sh/bash_completion
index 98c3556b20685a5c529901447d2163c6a1396c08..0a89e3f643b73348afd6fa89a380a2476e3377ef 100644
--- a/etc/config.sh/bash_completion
+++ b/etc/config.sh/bash_completion
@@ -98,7 +98,7 @@ foamAddCompletion()
 # The respective options are generated on-the-fly from the application's
 # -help-full output and cached to the _of_complete_cache_ global associative
 # array with entries formatted as "argOpts.. | boolOpts ..".
-# The '|' character separates options with and without arguments.
+# The '|' character separates options with/without arguments.
 #
 unset -f _of_complete_ 2>/dev/null
 _of_complete_()
@@ -134,12 +134,22 @@ _of_complete_()
         choices="${_of_complete_cache_[$appName]}"
 
         # Not in cache, obtain by parsing application -help-full
+        # Extract all options of the format
+        #   -opt1         descrip
+        #   -opt2 <arg>   descrip
+        #   -help-full
+        # Terminate parsing on first appearance of -help-full
+        # - options with '=' (eg, -mode=ugo) are not handled very well at all.
+        # - alternatives (eg, -a, -all) are not handled nicely either,
+        #   for these treat ',' like a space to catch the worst of them.
         if [ -z "$choices" ]
         then
-            # Treat ',' like space so '-a, -all' parses like '-a | -all'
-            # Options with '=' (Eg, -mode=ugo) are not handled very well.
             local helpText=$($appName -help-full 2>/dev/null | \
-                sed -ne 's/,/ /g' -e 's/=.*$/=/' -e '/^  *-/p')
+                sed -ne 's/^ *//; /^$/d; /^[^-]/d; /^--/d;' \
+                    -e 'y/,/ /; s/=.*$/=/;' \
+                    -e '/^-[^ ]* </{ s/^\(-[^ ]* <\).*$/\1/; p; d }' \
+                    -e 's/^\(-[^ ]*\).*$/\1/; p; /^-help-full/q;' \
+                    )
 
             if [ -z "$helpText" ]
             then
@@ -147,10 +157,10 @@ _of_complete_()
                 choices="false"  # Mark failure to prevent repeating again
             else
                 # Array of options with args
-                local argOpts=($(awk '/^ {0,4}-[a-z]/ && /</ {print $1}' <<< "$helpText"))
+                local argOpts=($(awk '/</ {print $1}' <<< "$helpText"))
 
                 # Array of options without args
-                local boolOpts=($(awk '/^ {0,4}-[a-z]/ && !/</ {print $1}' <<< "$helpText"))
+                local boolOpts=($(awk '!/</ {print $1}' <<< "$helpText"))
 
                 choices="${argOpts[@]} | ${boolOpts[@]}"
             fi