diff --git a/build/lbuild b/build/lbuild
index 2c2340d82b6c256fa8e2ad6dfd80ecf958803655..0a7c5a81bf9ae193ded2d53faf45b7bff3681f09 100755
--- a/build/lbuild
+++ b/build/lbuild
@@ -510,7 +510,7 @@ load_target()
 
     BUILD_ARCHS=
     for arch in $(uniqify "$ALL_ARCHS") ; do
-        if [ -z "$TARGET_ARCHS" ] || [[ $TARGET_ARCHES =~ (\ |^)$arch(\ |$) ]] ; then
+        if [ -z "$TARGET_ARCHS" ] || echo "$TARGET_ARCHS" | grep -w "$arch" >/dev/null 2>/dev/null ; then
             BUILD_ARCHS="$BUILD_ARCHS $arch"
         fi
     done