diff --git a/twosheds/transformation.py b/twosheds/transformation.py
index <HASH>..<HASH> 100644
--- a/twosheds/transformation.py
+++ b/twosheds/transformation.py
@@ -41,16 +41,9 @@ class VariableTransformation(Transformation):
     """Expands environmental variables."""
     def expand(self, sentence):
         """Expand environmental variables in a sentence."""
-        tokens = sentence.split()
-        new_tokens = []
-        for token in tokens:
-            if token.startswith("$"):
-                try:
-                    token = os.environ[token[1:]]
-                except KeyError:
-                    pass
-            new_tokens.append(token)
-        return " ".join(new_tokens)
+        for k, v in os.environ.iteritems():
+            sentence = sentence.replace("$" + k, v)
+        return sentence
 
 
 class TildeTransformation(Transformation):
Expand environmental variables properly

Previously, environmental were expanded only if they occurred as an
individual token, delimited by whitespace. This change make it so that
an environmental variable found anywhere in a sentence will be expanded,
which is in line with correct behavior.