diff --git a/bin/foamCleanPath b/bin/foamCleanPath
index 86a8c171fd828eea9af9388fa0d02a165217e9cd..d3f8007023c5d744d9589fdcb41cffaa55b2a452 100755
--- a/bin/foamCleanPath
+++ b/bin/foamCleanPath
@@ -99,7 +99,7 @@ IFS=': '
 # or may contain ':' separators
 set -- $*
 
-# strip out wildcards via sed
+# Strip out wildcards via sed. Path and wildcard cannot contain '?'.
 while [ "$#" -ge 1 ]
 do
     wildcard=$1
@@ -107,7 +107,7 @@ do
     ##DEBUG echo "remove>$wildcard<" 1>&2
     if [ -n "$wildcard" ]
     then
-        dirList=$(echo "$dirList:" | sed -e "s@${wildcard}[^:]*:@@g")
+        dirList=$(echo "$dirList:" | sed -e "s?${wildcard}[^:]*:??g")
     fi
 done
 
diff --git a/bin/tools/doxyFilter b/bin/tools/doxyFilter
index 061c72e526a503d94e8424e8151c8c55cf4800e6..ed427da1049f709e85e054146513834c00c71935 100755
--- a/bin/tools/doxyFilter
+++ b/bin/tools/doxyFilter
@@ -39,15 +39,15 @@
 if [ "$#" -gt 0 ]
 then
 
-    realFilePath=$(echo $1 | sed -e s@^$WM_PROJECT_DIR@../../..@ )
+    realFilePath=$(echo "$1" | sed -e "s?^$WM_PROJECT_DIR?../../..?" )
     if [ -n "$FOAM_ONLINE_REPO" ]
     then
-        filePath=$(echo $1 | sed -e s@^$WM_PROJECT_DIR@$FOAM_ONLINE_REPO@ )
+        filePath=$(echo "$1" | sed -e "s?^$WM_PROJECT_DIR?$FOAM_ONLINE_REPO?" )
     else
         filePath=$realFilePath
     fi
 
-    # dirName=$(echo "$filePath" | sed -e 's@/[^/]*$@@' )
+    # dirName=$(echo "$filePath" | sed -e 's?/[^/]*$??' )
     dirName=${filePath%/[^/]*}
     fileName=${filePath##*/}
 
@@ -62,7 +62,7 @@ then
 #        ;;
     esac
 
-    awk -f $WM_PROJECT_DIR/bin/tools/doxyFilter-table.awk $1 | \
+    awk -f $WM_PROJECT_DIR/bin/tools/doxyFilter-table.awk "$1" | \
     awk -f $awkScript  | \
     sed -f $WM_PROJECT_DIR/bin/tools/doxyFilter.sed \
         -e s@%realFilePath%@$realFilePath@g \