diff --git a/hakyll.cabal b/hakyll.cabal
--- a/hakyll.cabal
+++ b/hakyll.cabal
@@ -1,5 +1,5 @@
 Name:           hakyll
-Version:        0.4
+Version:        0.4.1
 
 Synopsis:       A simple static site generator library.
 Description:
@@ -8,13 +8,18 @@
 Author:         Jasper Van der Jeugt
 Maintainer:     jaspervdj@gmail.com
 Homepage:       http://jaspervdj.be/hakyll
+Bug-Reports:    http://github.com/jaspervdj/Hakyll/issues
 License:        BSD3
 License-File:   LICENSE
 Category:       Text
-Cabal-Version:  >= 1.2
+Cabal-Version:  >= 1.6
 
 build-type:     Simple
 
+source-repository head
+  type: git
+  location: git://github.com/jaspervdj/Hakyll.git
+
 library
   ghc-options: -Wall
   hs-source-dirs: src/
@@ -23,9 +28,10 @@
                    filepath >= 1.1,
                    directory >= 1,
                    containers >= 0.1,
-                   bytestring >= 0.9 && <= 0.9.1.4,
+                   bytestring >= 0.9 && < 0.9.2,
                    pandoc >= 1,
-                   regex-compat >= 0.92,
+                   regex-base >= 0.83,
+                   regex-tdfa >= 0.92,
                    network >= 2,
                    mtl >= 1.1,
                    old-locale >= 1,
@@ -40,4 +46,5 @@
                    Text.Hakyll.Util
                    Text.Hakyll.Tags
                    Text.Hakyll.Context
+                   Text.Hakyll.Regex
                    Network.Hakyll.SimpleServer
diff --git a/src/Network/Hakyll/SimpleServer.hs b/src/Network/Hakyll/SimpleServer.hs
--- a/src/Network/Hakyll/SimpleServer.hs
+++ b/src/Network/Hakyll/SimpleServer.hs
@@ -17,6 +17,7 @@
 import qualified Data.Map as M
 
 import Text.Hakyll.Util
+import Text.Hakyll.Regex
 
 -- | Function to log from a chan.
 log :: Chan String -> IO ()
diff --git a/src/Text/Hakyll/CompressCSS.hs b/src/Text/Hakyll/CompressCSS.hs
--- a/src/Text/Hakyll/CompressCSS.hs
+++ b/src/Text/Hakyll/CompressCSS.hs
@@ -3,27 +3,23 @@
     ) where
 
 import Data.List (isPrefixOf)
-import Text.Regex (subRegex, mkRegex)
-
--- | subRegex with arguments flipped for easy function composition.
-subRegex' :: String -> String -> String -> String
-subRegex' pattern replacement str = subRegex (mkRegex pattern) str replacement
+import Text.Hakyll.Regex (substitute)
 
 -- | Compress CSS to speed up your site.
 compressCSS :: String -> String
 compressCSS = compressSeparators
-            . compressWhitespace
             . stripComments
+            . compressWhitespace
 
 -- | Compresses certain forms of separators.
 compressSeparators :: String -> String
-compressSeparators = subRegex' ";\\s*}" "}" 
-                   . subRegex' "\\s*([{};:])\\s*" "\\1"
-                   . subRegex' ";;*" ";"
+compressSeparators = substitute "; *}" "}" 
+                   . substitute " *([{};:]) *" "\\1"
+                   . substitute ";;*" ";"
 
 -- | Compresses all whitespace.
 compressWhitespace :: String -> String
-compressWhitespace = subRegex' "\\s\\s*" " "
+compressWhitespace = substitute "[ \t\n][ \t\n]*" " "
 
 -- | Function that strips CSS comments away.
 stripComments :: String -> String
diff --git a/src/Text/Hakyll/Context.hs b/src/Text/Hakyll/Context.hs
--- a/src/Text/Hakyll/Context.hs
+++ b/src/Text/Hakyll/Context.hs
@@ -10,11 +10,11 @@
 
 import System.Locale (defaultTimeLocale)
 import System.FilePath (takeFileName)
-import Text.Regex (subRegex, mkRegex)
 import Text.Template (Context)
 import Data.Time.Format (parseTime, formatTime)
 import Data.Time.Clock (UTCTime)
 import Data.Maybe (fromMaybe)
+import Text.Hakyll.Regex (substitute)
 
 -- | Type for context manipulating functions.
 type ContextManipulation = Context -> Context
@@ -38,9 +38,8 @@
     M.insert (B.pack key) (B.pack value) context
     where value = fromMaybe defaultValue pretty
           pretty = do filePath <- M.lookup (B.pack "path") context
-                      let dateString = subRegex (mkRegex "^([0-9]*-[0-9]*-[0-9]*).*")
-                                                (takeFileName $ B.unpack filePath)
-                                                "\\1"
+                      let dateString = substitute "^([0-9]*-[0-9]*-[0-9]*).*" "\\1"
+                                                  (takeFileName $ B.unpack filePath)
                       time <- parseTime defaultTimeLocale
                                         "%Y-%m-%d"
                                         dateString :: Maybe UTCTime
diff --git a/src/Text/Hakyll/Regex.hs b/src/Text/Hakyll/Regex.hs
new file mode 100644
--- /dev/null
+++ b/src/Text/Hakyll/Regex.hs
@@ -0,0 +1,66 @@
+-- | A module that exports a simple regex interface. This code is mostly copied
+--   from the regex-compat package at hackage.
+module Text.Hakyll.Regex
+    ( split
+    , substitute
+    ) where
+
+import Text.Regex.TDFA
+
+-- | Match a regular expression against a string, returning more information
+--   about the match.
+matchRegexAll :: Regex -> String -> Maybe (String, String, String, [String])
+matchRegexAll p str = matchM p str
+
+-- | Replaces every occurance of the given regexp with the replacement string.
+subRegex :: Regex                          -- ^ Search pattern
+      -> String                         -- ^ Input string
+      -> String                         -- ^ Replacement text
+      -> String                         -- ^ Output string
+subRegex _ "" _ = ""
+subRegex regexp inp replacement =
+  let -- bre matches a backslash then capture either a backslash or some digits
+      bre = makeRegex "\\\\(\\\\|[0-9]+)"
+      lookup' _ [] _ = []
+      lookup' [] _ _ = []
+      lookup' match' repl groups =
+        case matchRegexAll bre repl of
+          Nothing -> repl
+          Just (lead, _, trail, bgroups) ->
+            let newval =
+                 if (head bgroups) == "\\"
+                   then "\\"
+                   else let index :: Int
+                            index = (read (head bgroups)) - 1
+                        in if index == -1
+                             then match'
+                             else groups !! index
+            in lead ++ newval ++ lookup' match' trail groups
+  in case matchRegexAll regexp inp of
+       Nothing -> inp
+       Just (lead, match', trail, groups) ->
+         lead ++ lookup' match' replacement groups ++ (subRegex regexp trail replacement)
+
+-- | Splits a string based on a regular expression.  The regular expression
+--   should identify one delimiter.
+splitRegex :: Regex -> String -> [String]
+splitRegex _ [] = []
+splitRegex delim strIn = loop strIn where
+  loop str = case matchOnceText delim str of
+                Nothing -> [str]
+                Just (firstline, _, remainder) ->
+                  if null remainder
+                    then [firstline,""]
+                    else firstline : loop remainder
+
+-- | Split a list at a certain element.
+split :: String -> String -> [String]
+split pattern = filter (not . null)
+              . splitRegex (makeRegex pattern)
+
+-- | Substitute a regex. Simplified interface.
+substitute :: String -- ^ Pattern to replace (regex).
+           -> String -- ^ Replacement string.
+           -> String -- ^ Input string.
+           -> String -- ^ Result.
+substitute pattern replacement str = subRegex (makeRegex pattern) str replacement
diff --git a/src/Text/Hakyll/Tags.hs b/src/Text/Hakyll/Tags.hs
--- a/src/Text/Hakyll/Tags.hs
+++ b/src/Text/Hakyll/Tags.hs
@@ -12,6 +12,7 @@
 import Control.Monad (foldM)
 
 import Text.Hakyll.Context (ContextManipulation, renderValue)
+import Text.Hakyll.Regex
 import Text.Hakyll.Util
 import Text.Hakyll.Page
 import Control.Arrow (second)
diff --git a/src/Text/Hakyll/Util.hs b/src/Text/Hakyll/Util.hs
--- a/src/Text/Hakyll/Util.hs
+++ b/src/Text/Hakyll/Util.hs
@@ -1,12 +1,10 @@
 module Text.Hakyll.Util 
     ( trim
-    , split
     , stripHTML
     , link
     ) where
 
 import Data.Char (isSpace)
-import Text.Regex (splitRegex, mkRegex)
 
 -- | Trim a string (drop spaces and tabs at both sides).
 trim :: String -> String
@@ -22,11 +20,6 @@
     -- We need a failsafe tail function.
     where tail' [] = []
           tail' xs = tail xs
-
--- | Split a list at a certain element.
-split :: String -> String -> [String]
-split pattern = filter (not . null)
-              . splitRegex (mkRegex pattern)
 
 -- | Make a HTML link.
 --
