diff --git a/README.markdown b/README.markdown
--- a/README.markdown
+++ b/README.markdown
@@ -74,6 +74,8 @@
 
 &nbsp;&nbsp;&nbsp;&nbsp;&#x2612;&nbsp;&nbsp;2017-03-31  v0.12.0.0 [Move IsRegex into Text.RE](https://github.com/iconnect/regex/milestone/16)
 
+&nbsp;&nbsp;&nbsp;&nbsp;&#x2612;&nbsp;&nbsp;2017-04-02  v0.13.0.0 [Protect findCaptureID and add Find, re-sort-imports, tutorials](https://github.com/iconnect/regex/milestone/17)
+
 &nbsp;&nbsp;&nbsp;&nbsp;&#x2610;&nbsp;&nbsp;2017-04-03  v1.0.0.0  [First stable release](https://github.com/iconnect/regex/milestone/3)
 
 &nbsp;&nbsp;&nbsp;&nbsp;&#x2610;&nbsp;&nbsp;2017-08-31  v2.0.0.0  [Fast text replacement with benchmarks](https://github.com/iconnect/regex/milestone/4)
diff --git a/changelog b/changelog
--- a/changelog
+++ b/changelog
@@ -1,5 +1,14 @@
 -*-change-log-*-
 
+0.13.0.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-04-03
+  * Add a Find Tool (#106)
+  * TestBench to export Text.RE (#107)
+  * Consolidate cabal templates (#108)
+  * Add special tutorials (#109)
+  * Add sort-imports example (#110)
+  * Generalise Grep (#111)
+  * Tighten up findCaptureID (#112)
+
 0.12.0.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-03-31
   * Add Text.RE.REOptions to RE.Summa (#103)
   * Move IsRegex into Text.RE (#104)
diff --git a/examples/TestKit.lhs b/examples/TestKit.lhs
--- a/examples/TestKit.lhs
+++ b/examples/TestKit.lhs
@@ -24,14 +24,18 @@
   , include
   , cmp
   , dumpMacroTable
+  , sortImports
+  , read_file
+  , write_file
   ) where
 
 import           Control.Applicative
 import           Control.Exception
 import qualified Control.Monad                            as M
+import qualified Data.ByteString.Lazy.Char8               as LBS
+import qualified Data.List                                as L
 import           Data.Maybe
 import qualified Data.Text                                as T
-import qualified Data.ByteString.Lazy.Char8               as LBS
 import           Prelude.Compat
 import qualified Shelly                                   as SH
 import           System.Directory
@@ -39,12 +43,11 @@
 import           System.Exit
 import           System.IO
 import           Text.Printf
+import           Text.RE.Replace
 import           Text.RE.TDFA
 import           Text.RE.TestBench
 import           Text.RE.Tools.Grep
 import           Text.RE.Tools.Sed
-import           Text.RE.ZeInternals.Types.Match
-import           Text.RE.Replace
 \end{code}
 
 
@@ -180,12 +183,28 @@
 \begin{code}
 include :: LBS.ByteString -> IO LBS.ByteString
 include = sed' $ Select
-    [ Function [re|^%include ${file}(@{%string})$|] TOP   incl
-    , Function [re|^.*$|]                           TOP $ \_ _ _ _->return Nothing
+    [ Function [re|^%include ${file}(@{%string})$|]                              TOP incl
+    , Function [re|^%include ${file}(@{%string}) *exclude *${rex}(@{%string})$|] TOP incl
+    , Function [re|^.*$|]                                                        TOP nop
     ]
   where
-    incl _ mtch _ _ = Just <$> LBS.readFile (prs_s $ mtch !$$ [cp|file|])
-    prs_s           = maybe (error "include") T.unpack . parseString
+    incl _ mtch _ _ = include' mtch
+    nop  _ _    _ _ = return Nothing
+
+include' :: Match LBS.ByteString -> IO (Maybe LBS.ByteString)
+include' mtch = do
+    ftr <- case prs_s <$> mtch !$$? [cp|rex|] of
+      Nothing     -> return id
+      Just re_lbs -> excl <$> makeRegex re_lbs
+    Just . ftr <$> LBS.readFile (prs_s $ mtch !$$ [cp|file|])
+  where
+    excl :: RE -> LBS.ByteString -> LBS.ByteString
+    excl rex =
+        LBS.unlines . map (matchesSource . getLineMatches)
+          . filter (not . anyMatches . getLineMatches)
+          . grepFilter rex
+
+    prs_s  = maybe (error "include'") T.unpack . parseString
 \end{code}
 
 
@@ -220,4 +239,43 @@
 dumpMacroTable fp_t fp_s rty m_env = do
   writeFile fp_t $ formatMacroTable   rty              m_env
   writeFile fp_s $ formatMacroSources rty ExclCaptures m_env
+\end{code}
+
+
+sortImports
+-----------
+
+\begin{code}
+sortImports :: LBS.ByteString -> LBS.ByteString
+sortImports lbs =
+    LBS.unlines $ map (matchesSource . getLineMatches) $
+      hdr ++ L.sortBy cMp bdy
+  where
+    cMp ln1 ln2 = case (extr ln1,extr ln2) of
+        (Nothing,Nothing) -> EQ
+        (Nothing,Just _ ) -> GT
+        (Just _ ,Nothing) -> LT
+        (Just x ,Just  y) -> compare x y
+
+    extr Line{..} = case allMatches getLineMatches of
+      mtch:_  -> mtch !$$? [cp|mod|]
+      _       -> Nothing
+
+    (hdr,bdy) = span (not . anyMatches . getLineMatches) lns
+    lns       = grepFilter rex lbs
+    rex        = [re|^import +(qualified)? +${mod}([^ ].*)$|]
+\end{code}
+
+
+read_file and write_file
+------------------------
+
+\begin{code}
+read_file :: FilePath -> IO LBS.ByteString
+read_file "-" = LBS.getContents
+read_file fp  = LBS.readFile fp
+
+write_file :: FilePath -> LBS.ByteString ->IO ()
+write_file "-" = LBS.putStr
+write_file fp  = LBS.writeFile fp
 \end{code}
diff --git a/examples/re-gen-modules.lhs b/examples/re-gen-modules.lhs
--- a/examples/re-gen-modules.lhs
+++ b/examples/re-gen-modules.lhs
@@ -16,15 +16,14 @@
 
 module Main (main) where
 
-import           Control.Exception
 import qualified Data.ByteString.Lazy.Char8               as LBS
 import qualified Data.Text                                as T
 import           Prelude.Compat
-import qualified Shelly                                   as SH
 import           System.Directory
 import           System.Environment
 import           System.Exit
 import           System.IO
+import           TestKit
 import           Text.RE.TDFA.ByteString.Lazy
 import           Text.RE.Tools.Sed
 
@@ -62,9 +61,11 @@
 test' :: ModPath -> (ModPath,SedScript) -> IO Bool
 test' src_mp (mp,scr) = do
     putStrLn mp
-    tp <- is_text_present
-    sed scr (mod_filepath tp src_mp) tmp_pth
-    cmp     (T.pack tmp_pth) (T.pack $ mod_filepath tp mp)
+    tp   <- is_text_present
+    lbs  <- read_file $ mod_filepath tp src_mp
+    lbs' <- sortImports <$> sed' scr lbs
+    write_file tmp_pth lbs'
+    cmp  (T.pack tmp_pth) (T.pack $ mod_filepath tp mp)
   where
     tmp_pth = "tmp/prog.hs"
 
@@ -83,8 +84,10 @@
 gen' :: FilePath -> (ModPath,SedScript) -> IO ()
 gen' src_mp (mp,scr) = do
   putStrLn mp
-  tp <- is_text_present
-  sed scr (mod_filepath tp src_mp) (mod_filepath tp mp)
+  tp   <- is_text_present
+  lbs  <- read_file $ mod_filepath tp src_mp
+  lbs' <- sortImports <$> sed' scr lbs
+  write_file (mod_filepath tp mp) lbs'
 
 
 ------------------------------------------------------------------------
@@ -228,16 +231,4 @@
 
 is_text_present :: IO Bool
 is_text_present = doesDirectoryExist "Text"
-
-cmp :: T.Text -> T.Text -> IO Bool
-cmp src dst = handle hdl $ do
-    _ <- SH.shelly $ SH.verbosely $
-        SH.run "cmp" [src,dst]
-    return True
-  where
-    hdl :: SomeException -> IO Bool
-    hdl se = do
-      hPutStrLn stderr $
-        "testing results against model answers failed: " ++ show se
-      return False
 \end{code}
diff --git a/examples/re-include.lhs b/examples/re-include.lhs
--- a/examples/re-include.lhs
+++ b/examples/re-include.lhs
@@ -32,12 +32,12 @@
 import           System.Environment
 import           TestKit
 import           Text.RE
-import           Text.RE.Tools.Edit
+import           Text.RE.Replace
 import           Text.RE.TDFA.ByteString.Lazy
 import           Text.RE.TestBench
+import           Text.RE.Tools.Edit
 import           Text.RE.Tools.Grep
 import           Text.RE.Tools.Sed
-import           Text.RE.Replace
 \end{code}
 
 \begin{code}
@@ -135,7 +135,7 @@
 
 \begin{code}
 scan :: RE -> [LBS.ByteString] -> [Token]
-scan rex = grepScript
+scan rex = grepWithScript
     [ (,) [re|\\begin\{code\}|] $ \i -> chk $ Bra i
     , (,) rex                   $ \_ -> chk   Hit
     , (,) [re|\\end\{code\}|]   $ \i -> chk $ Ket i
diff --git a/examples/re-nginx-log-processor.lhs b/examples/re-nginx-log-processor.lhs
--- a/examples/re-nginx-log-processor.lhs
+++ b/examples/re-nginx-log-processor.lhs
@@ -29,27 +29,27 @@
 import           Control.Monad
 import qualified Data.ByteString.Lazy.Char8               as LBS
 import           Data.Char
-import qualified Data.HashMap.Lazy                        as HML
 import           Data.Functor.Identity
+import qualified Data.HashMap.Lazy                        as HML
 import           Data.Maybe
 import           Data.String
 import qualified Data.Text                                as T
 import           Data.Time
 import           Prelude.Compat
 import           System.Directory
-import           System.FilePath
 import           System.Environment
 import           System.Exit
+import           System.FilePath
 import           System.IO
 import           TestKit
+import           Text.Printf
 import           Text.RE
 import           Text.RE.PCRE.ByteString.Lazy
 import qualified Text.RE.PCRE.String                      as S
-import           Text.RE.TestBench
-import           Text.RE.Tools.Sed
 import           Text.RE.REOptions
 import           Text.RE.Replace
-import           Text.Printf
+import           Text.RE.TestBench
+import           Text.RE.Tools.Sed
 \end{code}
 
 \begin{code}
diff --git a/examples/re-prep.lhs b/examples/re-prep.lhs
--- a/examples/re-prep.lhs
+++ b/examples/re-prep.lhs
@@ -28,22 +28,22 @@
 import           Data.Maybe
 import           Data.Monoid
 import qualified Data.Text                                as T
-import qualified Data.Text.Encoding                       as TE
 import           Network.HTTP.Conduit
 import           Prelude.Compat
 import qualified Shelly                                   as SH
 import           System.Directory
 import           System.Environment
+import           System.FilePath
 import           System.IO
 import           TestKit
 import           Text.Heredoc
 import           Text.RE
+import           Text.RE.Replace
+import           Text.RE.TDFA.ByteString.Lazy
+import qualified Text.RE.TDFA.String                      as TS
 import           Text.RE.TestBench
 import           Text.RE.Tools.Grep
 import           Text.RE.Tools.Sed
-import           Text.RE.TDFA.ByteString.Lazy
-import qualified Text.RE.TDFA.Text                        as TT
-import           Text.RE.Replace
 \end{code}
 
 \begin{code}
@@ -178,37 +178,51 @@
     pd "RE/Tools/Edit"
     pd "RE/Tools/Grep"
     pd "RE/Tools/Sed"
-    pd "RE/ZeInternals/Lex"
     pd "RE/ZeInternals/NamedCaptures"
     pd "RE/ZeInternals/Replace"
     pd "RE/ZeInternals/TestBench"
+    pd "RE/ZeInternals/Tools/Lex"
     pd "RE/ZeInternals/Types/IsRegex"
     pd "RE/ZeInternals/Types/Matches"
     pd "RE/ZeInternals/Types/Match"
     pd "RE/ZeInternals/Types/Capture"
     -- render the tutorial in HTML
-    prep_tut Doc "examples/re-tutorial-master.lhs" "tmp/re-tutorial.lhs"
     createDirectoryIfMissing False "tmp"
-    pandoc_lhs'
-      "re-tutorial.lhs"
-      "examples/re-tutorial.lhs"
-      "tmp/re-tutorial.lhs"
-      "docs/re-tutorial.html"
-    -- generate the tutorial-based tests
-    gm <- genMode
-    prep_tut gm "examples/re-tutorial-master.lhs" "examples/re-tutorial.lhs"
-    putStrLn ">> examples/re-tutorial.lhs"
+    gen_tutorial "tutorial"
+    gen_tutorial "tutorial-options"
+    gen_tutorial "tutorial-replacing"
+    gen_tutorial "tutorial-testbench"
+    gen_tutorial "tutorial-tools"
     pages
   where
     pd fnm = case (mtch !$$? [cp|fdr|],mtch !$$? [cp|mnm|]) of
-        (Nothing ,Just mnm) -> pandoc_lhs ("Text.RE."          <>mnm) ("Text/"    <>fnm<>".lhs") ("docs/"<>mnm<>".html")
-        (Just fdr,Just mnm) -> pandoc_lhs ("Text.RE."<>fdr<>"."<>mnm) ("Text/"    <>fnm<>".lhs") ("docs/"<>mnm<>".html")
-        _                   -> pandoc_lhs ("examples/"<>fnm<>".lhs" ) ("examples/"<>fnm<>".lhs") ("docs/"<>fnm<>".html")
+        (Nothing ,Just mnm) -> pandoc_lhs ("Text.RE."          ++mnm) ("Text/"    ++fnm++".lhs") ("docs/"++mnm++".html")
+        (Just fdr,Just mnm) -> pandoc_lhs ("Text.RE."++fdr++"."++mnm) ("Text/"    ++fnm++".lhs") ("docs/"++mnm++".html")
+        _                   -> pandoc_lhs ("examples/"++fnm++".lhs" ) ("examples/"++fnm++".lhs") ("docs/"++fnm++".html")
       where
-        mtch = fnm TT.?=~ [re|^RE/(${fdr}(Internal|PCRE|TDFA|Testbench|Tools|Types)/)?${mnm}(@{%id})|]
+        mtch = fnm TS.?=~ [re|^RE/(${fdr}(Internal|PCRE|TDFA|Testbench|Tools|Types)/)?${mnm}(@{%id})|]
 \end{code}
 
 
+\begin{code}
+gen_tutorial :: String -> IO ()
+gen_tutorial nm = do
+    prep_tut Doc ("examples" </> mst) ("tmp" </> tgt)
+    pandoc_lhs'       tgt
+      ("examples" </> tgt)
+      ("tmp"      </> tgt)
+      ("docs"     </> htm)
+    -- generate the tutorial-based tests
+    gm <- genMode
+    prep_tut gm ("examples" </> mst) ("examples" </> tgt)
+    putStrLn $ ">> " ++ ("examples" </> tgt)
+  where
+    tgt = "re-" ++ nm ++ ".lhs"
+    htm = "re-" ++ nm ++ ".html"
+    mst = "re-" ++ nm ++ "-master.lhs"
+\end{code}
+
+
 Generating the Tutorial
 -----------------------
 
@@ -359,7 +373,7 @@
 
 \begin{code}
 scan :: RE -> [LBS.ByteString] -> [Token]
-scan rex = grepScript
+scan rex = grepWithScript
     [ (,) [re|\\begin\{code\}|] $ \i -> chk $ Bra i
     , (,) rex                   $ \_ -> chk   Hit
     , (,) [re|\\end\{code\}|]   $ \i -> chk $ Ket i
@@ -703,15 +717,15 @@
 ----------------------
 
 \begin{code}
-pandoc_lhs :: T.Text -> T.Text -> T.Text -> IO ()
+pandoc_lhs :: String -> String -> String -> IO ()
 pandoc_lhs title in_file = pandoc_lhs' title in_file in_file
 
-pandoc_lhs' :: T.Text -> T.Text -> T.Text -> T.Text -> IO ()
+pandoc_lhs' :: String -> String -> String -> String -> IO ()
 pandoc_lhs' title repo_path in_file out_file = do
   LBS.writeFile "tmp/metadata.markdown"  $
                     LBS.unlines
                       [ "---"
-                      , "title: "<>LBS.fromStrict (TE.encodeUtf8 title)
+                      , "title: "<>LBS.pack title
                       , "---"
                       ]
   LBS.writeFile "tmp/bc.html" bc
@@ -728,9 +742,9 @@
         , "-A", "tmp/ft.html"
         , "-c", "lib/lhs-styles.css"
         , "-c", "lib/bs.css"
-        , "-o", out_file
+        , "-o", T.pack out_file
         , "tmp/metadata.markdown"
-        , in_file
+        , T.pack in_file
         ]
   where
     bc = LBS.unlines
@@ -741,7 +755,7 @@
       , "  <ol class='breadcrumb'>"
       , "    <li>"<>branding<>"</li>"
       , "    <li><a title='source file' href='" <>
-              repo_url <> "'>" <> (LBS.pack $ T.unpack title) <> "</a></li>"
+              repo_url <> "'>" <> (LBS.pack title) <> "</a></li>"
       , "</ol>"
       , "</div>"
       , "<div class='litcontent'>"
@@ -753,7 +767,7 @@
 
     repo_url = LBS.concat
       [ "https://github.com/iconnect/regex/blob/master/"
-      , LBS.pack $ T.unpack repo_path
+      , LBS.pack repo_path
       ]
 \end{code}
 
diff --git a/examples/re-sort-imports.lhs b/examples/re-sort-imports.lhs
new file mode 100644
--- /dev/null
+++ b/examples/re-sort-imports.lhs
@@ -0,0 +1,130 @@
+Example: Sort-Import Processor
+==============================
+
+This example looks for Haskell files and sorts their import statements
+into a standard (alphabetical) order
+
+\begin{code}
+{-# LANGUAGE NoImplicitPrelude          #-}
+{-# LANGUAGE RecordWildCards            #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE TemplateHaskell            #-}
+{-# LANGUAGE QuasiQuotes                #-}
+{-# LANGUAGE OverloadedStrings          #-}
+
+module Main
+  ( main
+  ) where
+
+import           Control.Applicative
+import qualified Control.Monad                            as M
+import qualified Data.ByteString.Lazy.Char8               as LBS
+import           Prelude.Compat
+import           System.Directory
+import           System.Environment
+import           System.Exit
+import           System.FilePath
+import           TestKit
+import           Text.Printf
+import           Text.RE.TDFA.String
+import           Text.RE.Tools.Find
+\end{code}
+
+Mode
+----
+
+This program can run in one of two modes.
+
+\begin{code}
+data Mode
+    = Check           -- only check for unsorted files, generating an
+                      -- error if any not sorted
+    | Update          -- update any unsorted files
+  deriving (Eq,Show)
+\end{code}
+
+\begin{code}
+main :: IO ()
+main = do
+  as  <- getArgs
+  case as of
+    []                         -> test
+    ["test"]                   -> test
+    ["update",fp] | is_file fp -> sort_r Update fp
+    ["check" ,fp] | is_file fp -> sort_r Check  fp
+    _                          -> usage
+  where
+    is_file = not . (== "--") . take 2
+
+    test = do
+      sort_r Check "Text"
+      sort_r Check "examples"
+
+    usage = do
+      prg <- getProgName
+      putStr $ unlines
+        [ "usage:"
+        , "  "++prg++" [test]"
+        , "  "++prg++" <directory>"
+        ]
+\end{code}
+
+
+The Find Script
+---------------
+
+\begin{code}
+sort_r :: Mode -> FilePath -> IO ()
+sort_r md root = findMatches fm [re|\.l?hs|] root >>= sort_these md root
+  where
+    fm = FindMethods
+      { doesDirectoryExistDM = doesDirectoryExist
+      , listDirectoryDM      = getDirectoryContents
+      , combineDM            = (</>)
+      }
+\end{code}
+
+
+Processing the List of Files
+----------------------------
+
+\begin{code}
+sort_these :: Mode -> FilePath -> [FilePath] -> IO ()
+sort_these md root fps = do
+  ok <- and <$> mapM (sort_this md) fps
+  case ok of
+    True  -> msg "all imports sorted"
+    False -> case md of
+      Check  -> do
+        msg "Some imports need sorting"
+        exitWith $ ExitFailure 1
+      Update ->
+        msg "Some imports were sorted"
+  where
+    msg :: String -> IO ()
+    msg s = printf "%-10s : %s\n" root s
+\end{code}
+
+
+Processing a single File
+------------------------
+
+\begin{code}
+sort_this :: Mode -> FilePath -> IO Bool
+sort_this md fp = LBS.readFile fp >>= sort_this'
+  where
+    sort_this' lbs = do
+        M.when (not same)   $ putStrLn fp
+        M.when (md==Update) $ LBS.writeFile fp lbs'
+        return same
+      where
+        same = lbs==lbs'
+        lbs' = sortImports lbs
+\end{code}
+
+
+Sorting the Imports of the Text of a Haskell Script
+---------------------------------------------------
+
+The function for sorting a Haskell script, `sortImports` has been
+placed in `TestKit` so that it can be shared with re-gen-modules`.
diff --git a/examples/re-tests.lhs b/examples/re-tests.lhs
--- a/examples/re-tests.lhs
+++ b/examples/re-tests.lhs
@@ -43,35 +43,37 @@
 import           System.Directory
 import           System.FilePath
 import           Test.SmallCheck.Series
-import           TestKit
 import           Test.Tasty
 import           Test.Tasty.HUnit
 import           Test.Tasty.SmallCheck          as SC
+import           TestKit
 import           Text.Heredoc
-import qualified Text.Regex.PCRE                as PCRE_
-import qualified Text.Regex.TDFA                as TDFA_
 import           Text.RE
-import           Text.RE.Replace
 import qualified Text.RE.PCRE                   as PCRE
-import           Text.RE.TDFA                   as TDFA
-import           Text.RE.TestBench
-import           Text.RE.Tools.Sed
-import           Text.RE.ZeInternals.AddCaptureNames
-import           Text.RE.ZeInternals.NamedCaptures
-import           Text.RE.ZeInternals.PreludeMacros
-import           Text.RE.REOptions
-
-import qualified Text.RE.PCRE.String            as P_ST
 import qualified Text.RE.PCRE.ByteString        as P_BS
 import qualified Text.RE.PCRE.ByteString.Lazy   as PLBS
 import qualified Text.RE.PCRE.Sequence          as P_SQ
-
-import qualified Text.RE.TDFA.String            as T_ST
+import qualified Text.RE.PCRE.String            as P_ST
+import           Text.RE.REOptions
+import           Text.RE.Replace
+import           Text.RE.TDFA                   as TDFA
 import qualified Text.RE.TDFA.ByteString        as T_BS
 import qualified Text.RE.TDFA.ByteString.Lazy   as TLBS
 import qualified Text.RE.TDFA.Sequence          as T_SQ
+import qualified Text.RE.TDFA.String            as T_ST
 import qualified Text.RE.TDFA.Text              as T_TX
 import qualified Text.RE.TDFA.Text.Lazy         as TLTX
+import           Text.RE.TestBench
+import           Text.RE.Tools.Find
+import           Text.RE.Tools.Sed
+import           Text.RE.ZeInternals.AddCaptureNames
+import           Text.RE.ZeInternals.NamedCaptures
+import           Text.RE.ZeInternals.PreludeMacros
+import           Text.RE.ZeInternals.Types.CaptureID
+import qualified Text.Regex.PCRE                as PCRE_
+import qualified Text.Regex.TDFA                as TDFA_
+
+
 \end{code}
 
 
@@ -89,6 +91,7 @@
     , many_tests
     , escape_tests
     , add_capture_names_tests
+    , find_tests
     , misc_tests
     ]
 \end{code}
@@ -586,14 +589,14 @@
 named_capture_tests :: TestTree
 named_capture_tests = localOption (SmallCheckDepth 4) $
   testGroup "NamedCaptures"
-    [ formatScanTestTree
-    , analyseTokensTestTree
+    [ format_scan_tests
+    , analyse_tokens_tests
     ]
 
 instance Monad m => Serial m Token
 
-formatScanTestTree :: TestTree
-formatScanTestTree =
+format_scan_tests :: TestTree
+format_scan_tests =
   testGroup "FormatToken/Scan Properties"
     [ localOption (SmallCheckDepth 4) $
         SC.testProperty "formatTokens == formatTokens0" $
@@ -604,8 +607,8 @@
                     scan (formatTokens' idFormatTokenREOptions tks) == tks
     ]
 
-analyseTokensTestTree :: TestTree
-analyseTokensTestTree =
+analyse_tokens_tests :: TestTree
+analyse_tokens_tests =
   testGroup "Analysing [Token] Unit Tests"
     [ tc [here|foobar|]                                       []
     , tc [here||]                                             []
@@ -633,7 +636,7 @@
 
     xnc = either oops (snd . fst) . extractNamedCaptures
       where
-        oops = error "analyseTokensTestTree: unexpected parse failure"
+        oops = error "analyse_tokens_tests: unexpected parse failure"
 \end{code}
 
 
@@ -678,6 +681,44 @@
 \end{code}
 
 
+The Find Tests
+--------------
+
+\begin{code}
+find_tests :: TestTree
+find_tests = testGroup "Find Tests"
+    [ testCase "examples/" $ do
+        fps <- findMatches findMethods [re|^re-.*\.lhs|] "examples/"
+        example_paths @=? filter (not . matched . (?=~ [re|master\.lhs|])) fps
+    ]
+
+example_paths :: [String]
+example_paths =
+  [ "examples/re-gen-cabals.lhs"
+  , "examples/re-gen-modules.lhs"
+  , "examples/re-include.lhs"
+  , "examples/re-nginx-log-processor.lhs"
+  , "examples/re-prep.lhs"
+  , "examples/re-sort-imports.lhs"
+  , "examples/re-tests.lhs"
+  , "examples/re-tutorial-options.lhs"
+  , "examples/re-tutorial-replacing.lhs"
+  , "examples/re-tutorial-testbench.lhs"
+  , "examples/re-tutorial-tools.lhs"
+  , "examples/re-tutorial.lhs"
+  ]
+
+findMethods :: FindMethods String
+findMethods =
+  FindMethods
+    { doesDirectoryExistDM = doesDirectoryExist
+    , listDirectoryDM      = getDirectoryContents
+    , combineDM            = (</>)
+    }
+
+\end{code}
+
+
 The Miscelaneous Tests
 ----------------------
 
@@ -686,7 +727,7 @@
 misc_tests = testGroup "Miscelaneous Tests"
     [ testGroup "CaptureID"
         [ testCase "CaptureID lookup failure" $ do
-            ok <- isValidError $ findCaptureID [cp|foo|] $ reCaptureNames [re|foo|]
+            ok <- isValidError $ unsafeFindCaptureID [cp|foo|] $ reCaptureNames [re|foo|]
             assertBool "failed" ok
         ]
     , testGroup "QQ"
diff --git a/examples/re-tutorial-options.lhs b/examples/re-tutorial-options.lhs
new file mode 100644
--- /dev/null
+++ b/examples/re-tutorial-options.lhs
@@ -0,0 +1,29 @@
+The Regex Options Tutorial
+==========================
+
+\begin{code}
+{-# LANGUAGE QuasiQuotes                      #-}
+{-# LANGUAGE NoImplicitPrelude                #-}
+{-# OPTIONS_GHC -fno-warn-missing-signatures  #-}
+\end{code}
+
+
+\begin{code}
+import           Prelude.Compat
+import           TestKit
+import           Text.RE.TDFA.String
+\end{code}
+
+
+\begin{code}
+evalme_TRD_00 = checkThis "evalme_TRD_00" (True) $ ("2016-01-09 2015-12-5 2015-10-05" =~ [re|[0-9]{4}-[0-9]{2}-[0-9]{2}|] :: Bool)
+\end{code}
+
+
+\begin{code}
+main :: IO ()
+main = runTheTests
+  [ evalme_TRD_00
+  ]
+\end{code}
+
diff --git a/examples/re-tutorial-replacing.lhs b/examples/re-tutorial-replacing.lhs
new file mode 100644
--- /dev/null
+++ b/examples/re-tutorial-replacing.lhs
@@ -0,0 +1,29 @@
+The Regex Options Tutorial
+==========================
+
+\begin{code}
+{-# LANGUAGE QuasiQuotes                      #-}
+{-# LANGUAGE NoImplicitPrelude                #-}
+{-# OPTIONS_GHC -fno-warn-missing-signatures  #-}
+\end{code}
+
+
+\begin{code}
+import           Prelude.Compat
+import           TestKit
+import           Text.RE.TDFA.String
+\end{code}
+
+
+\begin{code}
+evalme_TRD_00 = checkThis "evalme_TRD_00" (True) $ ("2016-01-09 2015-12-5 2015-10-05" =~ [re|[0-9]{4}-[0-9]{2}-[0-9]{2}|] :: Bool)
+\end{code}
+
+
+\begin{code}
+main :: IO ()
+main = runTheTests
+  [ evalme_TRD_00
+  ]
+\end{code}
+
diff --git a/examples/re-tutorial-testbench.lhs b/examples/re-tutorial-testbench.lhs
new file mode 100644
--- /dev/null
+++ b/examples/re-tutorial-testbench.lhs
@@ -0,0 +1,29 @@
+The Regex Options Tutorial
+==========================
+
+\begin{code}
+{-# LANGUAGE QuasiQuotes                      #-}
+{-# LANGUAGE NoImplicitPrelude                #-}
+{-# OPTIONS_GHC -fno-warn-missing-signatures  #-}
+\end{code}
+
+
+\begin{code}
+import           Prelude.Compat
+import           TestKit
+import           Text.RE.TDFA.String
+\end{code}
+
+
+\begin{code}
+evalme_TRD_00 = checkThis "evalme_TRD_00" (True) $ ("2016-01-09 2015-12-5 2015-10-05" =~ [re|[0-9]{4}-[0-9]{2}-[0-9]{2}|] :: Bool)
+\end{code}
+
+
+\begin{code}
+main :: IO ()
+main = runTheTests
+  [ evalme_TRD_00
+  ]
+\end{code}
+
diff --git a/examples/re-tutorial-tools.lhs b/examples/re-tutorial-tools.lhs
new file mode 100644
--- /dev/null
+++ b/examples/re-tutorial-tools.lhs
@@ -0,0 +1,29 @@
+The Regex Options Tutorial
+==========================
+
+\begin{code}
+{-# LANGUAGE QuasiQuotes                      #-}
+{-# LANGUAGE NoImplicitPrelude                #-}
+{-# OPTIONS_GHC -fno-warn-missing-signatures  #-}
+\end{code}
+
+
+\begin{code}
+import           Prelude.Compat
+import           TestKit
+import           Text.RE.TDFA.String
+\end{code}
+
+
+\begin{code}
+evalme_TRD_00 = checkThis "evalme_TRD_00" (True) $ ("2016-01-09 2015-12-5 2015-10-05" =~ [re|[0-9]{4}-[0-9]{2}-[0-9]{2}|] :: Bool)
+\end{code}
+
+
+\begin{code}
+main :: IO ()
+main = runTheTests
+  [ evalme_TRD_00
+  ]
+\end{code}
+
diff --git a/examples/re-tutorial.lhs b/examples/re-tutorial.lhs
--- a/examples/re-tutorial.lhs
+++ b/examples/re-tutorial.lhs
@@ -92,6 +92,12 @@
 dealing with bulk text will probably want to choose one of the other
 options.
 \begin{code}
+import           Control.Applicative
+import           Data.Maybe
+import qualified Data.Text                      as T
+import           Prelude.Compat
+import           TestKit
+import           Text.Printf
 import           Text.RE.REOptions
 import           Text.RE.Replace
 import           Text.RE.TDFA.String
@@ -104,18 +110,12 @@
 We will also need access to a small selection of common libraries for
 our examples.
 \begin{code}
-import           Control.Applicative
-import           Data.Maybe
-import qualified Data.Text                      as T
-import           Text.Printf
 \end{code}
 
 And finally we a special edition of the prelude (see the commentary for
 the pragma section above) and a small specail toolkit will be used to help
 manage the example calculations.
 \begin{code}
-import           Prelude.Compat
-import           TestKit
 \end{code}
 This allows simple calculations to be defined stylistically
 in the source program, presented as calculations when rendered
diff --git a/lib/cabal-masters/executables-incl.cabal b/lib/cabal-masters/executables-incl.cabal
--- a/lib/cabal-masters/executables-incl.cabal
+++ b/lib/cabal-masters/executables-incl.cabal
@@ -13,6 +13,9 @@
 
     Main-Is:            re-gen-modules.lhs
 
+    Other-Modules:
+      TestKit
+
 %build-depends-prog regex array base base-compat bytestring directory regex-base regex-tdfa shelly text
 
 %test-exe re-include
@@ -30,6 +33,9 @@
 
     Main-Is:            re-nginx-log-processor.lhs
 
+    Other-Modules:
+      TestKit
+
 %build-depends-prog regex regex-with-pcre array base base-compat bytestring directory filepath regex-base regex-tdfa shelly text time time-locale-compat transformers unordered-containers
 
 %test-exe re-prep
@@ -40,8 +46,18 @@
     Other-Modules:
       TestKit
 
-%build-depends-prog regex base base-compat bytestring directory heredoc http-conduit shelly text
+%build-depends-prog regex base base-compat bytestring directory filepath heredoc http-conduit shelly text
 
+%test-exe re-sort-imports
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-sort-imports.lhs
+
+    Other-Modules:
+      TestKit
+
+%build-depends-prog regex base base-compat bytestring directory filepath shelly text
+
 %test-exe re-tests
     Hs-Source-Dirs:     examples
 
@@ -72,5 +88,49 @@
       TestKit
 
     Extensions:         OverloadedStrings
+    Default-Extensions: QuasiQuotes
+%build-depends-prog regex array base base-compat bytestring containers directory hashable heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin shelly smallcheck tasty tasty-hunit tasty-smallcheck template-haskell transformers text time time-locale-compat unordered-containers
+
+%test-exe re-tutorial-options
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-options.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+%build-depends-prog regex array base base-compat bytestring containers directory hashable heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin shelly smallcheck tasty tasty-hunit tasty-smallcheck template-haskell transformers text time time-locale-compat unordered-containers
+
+%test-exe re-tutorial-replacing
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-replacing.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+%build-depends-prog regex array base base-compat bytestring containers directory hashable heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin shelly smallcheck tasty tasty-hunit tasty-smallcheck template-haskell transformers text time time-locale-compat unordered-containers
+
+%test-exe re-tutorial-testbench
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-testbench.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+%build-depends-prog regex array base base-compat bytestring containers directory hashable heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin shelly smallcheck tasty tasty-hunit tasty-smallcheck template-haskell transformers text time time-locale-compat unordered-containers
+
+%test-exe re-tutorial-tools
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-tools.lhs
+
+    Other-Modules:
+      TestKit
+
     Default-Extensions: QuasiQuotes
 %build-depends-prog regex array base base-compat bytestring containers directory hashable heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin shelly smallcheck tasty tasty-hunit tasty-smallcheck template-haskell transformers text time time-locale-compat unordered-containers
diff --git a/lib/cabal-masters/library-incl.cabal b/lib/cabal-masters/library-incl.cabal
--- a/lib/cabal-masters/library-incl.cabal
+++ b/lib/cabal-masters/library-incl.cabal
@@ -20,13 +20,13 @@
       Text.RE.TestBench
       Text.RE.Tools
       Text.RE.Tools.Edit
+      Text.RE.Tools.Find
       Text.RE.Tools.Grep
       Text.RE.Tools.Lex
       Text.RE.Tools.Sed
       Text.RE.ZeInternals
       Text.RE.ZeInternals.AddCaptureNames
       Text.RE.ZeInternals.EscapeREString
-      Text.RE.ZeInternals.Lex
       Text.RE.ZeInternals.NamedCaptures
       Text.RE.ZeInternals.PCRE
       Text.RE.ZeInternals.PreludeMacros
@@ -49,6 +49,8 @@
       Text.RE.ZeInternals.SearchReplace.TDFAEdPrime
       Text.RE.ZeInternals.TDFA
       Text.RE.ZeInternals.TestBench
+      Text.RE.ZeInternals.TestBench.Parsers
+      Text.RE.ZeInternals.Tools.Lex
       Text.RE.ZeInternals.Types.Capture
       Text.RE.ZeInternals.Types.CaptureID
       Text.RE.ZeInternals.Types.IsRegex
@@ -56,6 +58,5 @@
       Text.RE.ZeInternals.Types.Match
       Text.RE.ZeInternals.Types.Matches
       Text.RE.ZeInternals.Types.SearchReplace
-
 
 %build-depends-lib array bytestring base base-compat containers hashable regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin template-haskell text time time-locale-compat transformers unordered-containers
diff --git a/lib/cabal-masters/regex.cabal b/lib/cabal-masters/regex.cabal
--- a/lib/cabal-masters/regex.cabal
+++ b/lib/cabal-masters/regex.cabal
@@ -1,55 +1,5 @@
 Name:                   regex
 %include "lib/cabal-masters/regex-incl.cabal"
 %include "lib/cabal-masters/constraints-incl.cabal"
-
-Library
-    Hs-Source-Dirs:     .
-
-    Exposed-Modules:
-      Text.RE
-      Text.RE.REOptions
-      Text.RE.Replace
-      Text.RE.Summa
-      Text.RE.TDFA
-      Text.RE.TDFA.ByteString
-      Text.RE.TDFA.ByteString.Lazy
-      Text.RE.TDFA.Sequence
-      Text.RE.TDFA.String
-      Text.RE.TDFA.Text
-      Text.RE.TDFA.Text.Lazy
-      Text.RE.TestBench
-      Text.RE.Tools
-      Text.RE.Tools.Edit
-      Text.RE.Tools.Grep
-      Text.RE.Tools.Lex
-      Text.RE.Tools.Sed
-      Text.RE.ZeInternals
-      Text.RE.ZeInternals.AddCaptureNames
-      Text.RE.ZeInternals.EscapeREString
-      Text.RE.ZeInternals.Lex
-      Text.RE.ZeInternals.NamedCaptures
-      Text.RE.ZeInternals.PreludeMacros
-      Text.RE.ZeInternals.QQ
-      Text.RE.ZeInternals.Replace
-      Text.RE.ZeInternals.SearchReplace
-      Text.RE.ZeInternals.SearchReplace.TDFA
-      Text.RE.ZeInternals.SearchReplace.TDFA.ByteString
-      Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy
-      Text.RE.ZeInternals.SearchReplace.TDFA.Sequence
-      Text.RE.ZeInternals.SearchReplace.TDFA.String
-      Text.RE.ZeInternals.SearchReplace.TDFA.Text
-      Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy
-      Text.RE.ZeInternals.SearchReplace.TDFAEdPrime
-      Text.RE.ZeInternals.TDFA
-      Text.RE.ZeInternals.TestBench
-      Text.RE.ZeInternals.Types.Capture
-      Text.RE.ZeInternals.Types.CaptureID
-      Text.RE.ZeInternals.Types.IsRegex
-      Text.RE.ZeInternals.Types.LineNo
-      Text.RE.ZeInternals.Types.Match
-      Text.RE.ZeInternals.Types.Matches
-      Text.RE.ZeInternals.Types.SearchReplace
-
-%build-depends-lib array bytestring base base-compat containers hashable regex-base regex-tdfa regex-tdfa-text template-haskell text time time-locale-compat transformers unordered-containers
-
+%include "lib/cabal-masters/library-incl.cabal" exclude "PCRE"
 -- Generated with re-gen-cabals
diff --git a/lib/mega-regex.cabal b/lib/mega-regex.cabal
--- a/lib/mega-regex.cabal
+++ b/lib/mega-regex.cabal
@@ -1,5 +1,5 @@
 Name:                   regex
-Version:                0.12.0.0
+Version:                0.13.0.0
 Synopsis:               Toolkit for regex-base
 Description:            A regular expression toolkit for regex-base with
                         compile-time checking of RE syntax, data types for
@@ -63,7 +63,7 @@
 Source-Repository this
     Type:               git
     Location:           https://github.com/iconnect/regex.git
-    Tag:                0.12.0.0
+    Tag:                0.13.0.0
 
 
 
@@ -89,13 +89,13 @@
       Text.RE.TestBench
       Text.RE.Tools
       Text.RE.Tools.Edit
+      Text.RE.Tools.Find
       Text.RE.Tools.Grep
       Text.RE.Tools.Lex
       Text.RE.Tools.Sed
       Text.RE.ZeInternals
       Text.RE.ZeInternals.AddCaptureNames
       Text.RE.ZeInternals.EscapeREString
-      Text.RE.ZeInternals.Lex
       Text.RE.ZeInternals.NamedCaptures
       Text.RE.ZeInternals.PCRE
       Text.RE.ZeInternals.PreludeMacros
@@ -118,6 +118,8 @@
       Text.RE.ZeInternals.SearchReplace.TDFAEdPrime
       Text.RE.ZeInternals.TDFA
       Text.RE.ZeInternals.TestBench
+      Text.RE.ZeInternals.TestBench.Parsers
+      Text.RE.ZeInternals.Tools.Lex
       Text.RE.ZeInternals.Types.Capture
       Text.RE.ZeInternals.Types.CaptureID
       Text.RE.ZeInternals.Types.IsRegex
@@ -126,7 +128,6 @@
       Text.RE.ZeInternals.Types.Matches
       Text.RE.ZeInternals.Types.SearchReplace
 
-
     Default-Language:   Haskell2010
 
     Other-Extensions:
@@ -195,7 +196,7 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -225,7 +226,7 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -244,6 +245,9 @@
 
     Main-Is:            re-gen-modules.lhs
 
+    Other-Modules:
+      TestKit
+
     Default-Language:   Haskell2010
 
     GHC-Options:
@@ -252,7 +256,7 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -270,6 +274,9 @@
 
     Main-Is:            re-gen-modules.lhs
 
+    Other-Modules:
+      TestKit
+
     Default-Language:   Haskell2010
 
     GHC-Options:
@@ -278,7 +285,7 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -307,7 +314,7 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
@@ -333,7 +340,7 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
@@ -348,6 +355,9 @@
 
     Main-Is:            re-nginx-log-processor.lhs
 
+    Other-Modules:
+      TestKit
+
     Default-Language:   Haskell2010
 
     GHC-Options:
@@ -356,7 +366,7 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -379,6 +389,9 @@
 
     Main-Is:            re-nginx-log-processor.lhs
 
+    Other-Modules:
+      TestKit
+
     Default-Language:   Haskell2010
 
     GHC-Options:
@@ -387,7 +400,7 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -421,11 +434,12 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
       , directory            >= 1.2.1.0
+      , filepath             
       , heredoc              >= 0.2.0.0
       , http-conduit         >= 2.1.7.2
       , shelly               >= 1.6.1.2
@@ -449,11 +463,12 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
       , directory            >= 1.2.1.0
+      , filepath             
       , heredoc              >= 0.2.0.0
       , http-conduit         >= 2.1.7.2
       , shelly               >= 1.6.1.2
@@ -461,6 +476,60 @@
 
 
 
+Executable re-sort-imports
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-sort-imports.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Werror
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , directory            >= 1.2.1.0
+      , filepath             
+      , shelly               >= 1.6.1.2
+      , text                 >= 1.2.0.6
+
+
+Test-Suite re-sort-imports-test
+    type:               exitcode-stdio-1.0
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-sort-imports.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Werror
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , directory            >= 1.2.1.0
+      , filepath             
+      , shelly               >= 1.6.1.2
+      , text                 >= 1.2.0.6
+
+
+
 Executable re-tests
     Hs-Source-Dirs:     examples
 
@@ -477,7 +546,7 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -517,7 +586,7 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -558,7 +627,7 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -602,7 +671,7 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -648,7 +717,360 @@
       -Werror
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+
+Executable re-tutorial-options
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-options.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Werror
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+Test-Suite re-tutorial-options-test
+    type:               exitcode-stdio-1.0
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-options.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Werror
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+
+Executable re-tutorial-replacing
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-replacing.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Werror
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+Test-Suite re-tutorial-replacing-test
+    type:               exitcode-stdio-1.0
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-replacing.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Werror
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+
+Executable re-tutorial-testbench
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-testbench.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Werror
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+Test-Suite re-tutorial-testbench-test
+    type:               exitcode-stdio-1.0
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-testbench.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Werror
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+
+Executable re-tutorial-tools
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-tools.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Werror
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+
+Test-Suite re-tutorial-tools-test
+    type:               exitcode-stdio-1.0
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-tools.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Werror
+
+    Build-depends:
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
diff --git a/lib/version.txt b/lib/version.txt
--- a/lib/version.txt
+++ b/lib/version.txt
@@ -1,1 +1,1 @@
-0.12.0.0
+0.13.0.0
diff --git a/regex-examples.cabal b/regex-examples.cabal
--- a/regex-examples.cabal
+++ b/regex-examples.cabal
@@ -1,5 +1,5 @@
 Name:                   regex-examples
-Version:                0.12.0.0
+Version:                0.13.0.0
 Synopsis:               Tutorial, tests and example programs for regex
 Description:            Tutorial, tests and example programs for regex,
                         a Regular Expression Toolkit for regex-base with
@@ -63,7 +63,7 @@
 Source-Repository this
     Type:               git
     Location:           https://github.com/iconnect/regex.git
-    Tag:                0.12.0.0
+    Tag:                0.13.0.0
 
 
 Executable re-gen-cabals
@@ -82,7 +82,7 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -112,7 +112,7 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -131,6 +131,9 @@
 
     Main-Is:            re-gen-modules.lhs
 
+    Other-Modules:
+      TestKit
+
     Default-Language:   Haskell2010
 
     GHC-Options:
@@ -139,7 +142,7 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -157,6 +160,9 @@
 
     Main-Is:            re-gen-modules.lhs
 
+    Other-Modules:
+      TestKit
+
     Default-Language:   Haskell2010
 
     GHC-Options:
@@ -165,7 +171,7 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -194,7 +200,7 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
@@ -220,7 +226,7 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
@@ -235,6 +241,9 @@
 
     Main-Is:            re-nginx-log-processor.lhs
 
+    Other-Modules:
+      TestKit
+
     Default-Language:   Haskell2010
 
     GHC-Options:
@@ -243,8 +252,8 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
-      , regex-with-pcre      == 0.12.0.0
+        regex                == 0.13.0.0
+      , regex-with-pcre      == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -267,6 +276,9 @@
 
     Main-Is:            re-nginx-log-processor.lhs
 
+    Other-Modules:
+      TestKit
+
     Default-Language:   Haskell2010
 
     GHC-Options:
@@ -275,8 +287,8 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
-      , regex-with-pcre      == 0.12.0.0
+        regex                == 0.13.0.0
+      , regex-with-pcre      == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -310,11 +322,12 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
       , directory            >= 1.2.1.0
+      , filepath             
       , heredoc              >= 0.2.0.0
       , http-conduit         >= 2.1.7.2
       , shelly               >= 1.6.1.2
@@ -338,11 +351,12 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
       , directory            >= 1.2.1.0
+      , filepath             
       , heredoc              >= 0.2.0.0
       , http-conduit         >= 2.1.7.2
       , shelly               >= 1.6.1.2
@@ -350,6 +364,60 @@
 
 
 
+Executable re-sort-imports
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-sort-imports.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Wwarn
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , directory            >= 1.2.1.0
+      , filepath             
+      , shelly               >= 1.6.1.2
+      , text                 >= 1.2.0.6
+
+
+Test-Suite re-sort-imports-test
+    type:               exitcode-stdio-1.0
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-sort-imports.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Wwarn
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , directory            >= 1.2.1.0
+      , filepath             
+      , shelly               >= 1.6.1.2
+      , text                 >= 1.2.0.6
+
+
+
 Executable re-tests
     Hs-Source-Dirs:     examples
 
@@ -366,8 +434,8 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
-      , regex-with-pcre      == 0.12.0.0
+        regex                == 0.13.0.0
+      , regex-with-pcre      == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -407,8 +475,8 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
-      , regex-with-pcre      == 0.12.0.0
+        regex                == 0.13.0.0
+      , regex-with-pcre      == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -449,7 +517,7 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -493,7 +561,7 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -539,7 +607,360 @@
       -Wwarn
 
     Build-depends:
-        regex                == 0.12.0.0
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+
+Executable re-tutorial-options
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-options.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Wwarn
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+Test-Suite re-tutorial-options-test
+    type:               exitcode-stdio-1.0
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-options.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Wwarn
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+
+Executable re-tutorial-replacing
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-replacing.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Wwarn
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+Test-Suite re-tutorial-replacing-test
+    type:               exitcode-stdio-1.0
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-replacing.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Wwarn
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+
+Executable re-tutorial-testbench
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-testbench.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Wwarn
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+Test-Suite re-tutorial-testbench-test
+    type:               exitcode-stdio-1.0
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-testbench.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Wwarn
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+
+Executable re-tutorial-tools
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-tools.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Wwarn
+
+    Build-depends:
+        regex                == 0.13.0.0
+      , array                >= 0.4
+      , base                 >= 4 && < 5
+      , base-compat          >= 0.6.0
+      , bytestring           >= 0.10.2.0
+      , containers           >= 0.4
+      , directory            >= 1.2.1.0
+      , hashable             >= 1.2.3.3
+      , heredoc              >= 0.2.0.0
+      , regex-base           >= 0.93.2
+      , regex-pcre-builtin   >= 0.94.4.8.8.35
+      , regex-tdfa           >= 1.2.0
+      , regex-tdfa-text      >= 1.0.0.3
+      , shelly               >= 1.6.1.2
+      , smallcheck           >= 1.1.1
+      , tasty                >= 0.10.1.2
+      , tasty-hunit          >= 0.9.2
+      , tasty-smallcheck     >= 0.8.0.1
+      , template-haskell     >= 2.7
+      , text                 >= 1.2.0.6
+      , time                 >= 1.4.2
+      , time-locale-compat   >= 0.1.0.1
+      , transformers         >= 0.2.2
+      , unordered-containers >= 0.2.5.1
+
+
+
+Test-Suite re-tutorial-tools-test
+    type:               exitcode-stdio-1.0
+    Hs-Source-Dirs:     examples
+
+    Main-Is:            re-tutorial-tools.lhs
+
+    Other-Modules:
+      TestKit
+
+    Default-Extensions: QuasiQuotes
+    Default-Language:   Haskell2010
+
+    GHC-Options:
+      -Wall
+      -fwarn-tabs
+      -Wwarn
+
+    Build-depends:
+        regex                == 0.13.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
diff --git a/src/Text/RE/PCRE/ByteString.hs b/src/Text/RE/PCRE/ByteString.hs
--- a/src/Text/RE/PCRE/ByteString.hs
+++ b/src/Text/RE/PCRE/ByteString.hs
@@ -59,14 +59,14 @@
   , module Text.RE.ZeInternals.SearchReplace.PCRE.ByteString
   ) where
 
-import           Prelude.Compat
 import qualified Data.ByteString               as B
 import           Data.Typeable
+import           Prelude.Compat
 import           Text.RE.REOptions
 import           Text.RE.Replace
 import           Text.RE.ZeInternals.AddCaptureNames
-import           Text.RE.ZeInternals.SearchReplace.PCRE.ByteString
 import           Text.RE.ZeInternals.PCRE
+import           Text.RE.ZeInternals.SearchReplace.PCRE.ByteString
 import           Text.RE.ZeInternals.Types.IsRegex
 import           Text.Regex.Base
 import qualified Text.Regex.PCRE               as PCRE
diff --git a/src/Text/RE/PCRE/ByteString/Lazy.hs b/src/Text/RE/PCRE/ByteString/Lazy.hs
--- a/src/Text/RE/PCRE/ByteString/Lazy.hs
+++ b/src/Text/RE/PCRE/ByteString/Lazy.hs
@@ -59,14 +59,14 @@
   , module Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy
   ) where
 
-import           Prelude.Compat
 import qualified Data.ByteString.Lazy          as LBS
 import           Data.Typeable
+import           Prelude.Compat
 import           Text.RE.REOptions
 import           Text.RE.Replace
 import           Text.RE.ZeInternals.AddCaptureNames
-import           Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy
 import           Text.RE.ZeInternals.PCRE
+import           Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy
 import           Text.RE.ZeInternals.Types.IsRegex
 import           Text.Regex.Base
 import qualified Text.Regex.PCRE               as PCRE
diff --git a/src/Text/RE/PCRE/Sequence.hs b/src/Text/RE/PCRE/Sequence.hs
--- a/src/Text/RE/PCRE/Sequence.hs
+++ b/src/Text/RE/PCRE/Sequence.hs
@@ -59,14 +59,14 @@
   , module Text.RE.ZeInternals.SearchReplace.PCRE.Sequence
   ) where
 
-import           Prelude.Compat
 import qualified Data.Sequence                 as S
 import           Data.Typeable
+import           Prelude.Compat
 import           Text.RE.REOptions
 import           Text.RE.Replace
 import           Text.RE.ZeInternals.AddCaptureNames
-import           Text.RE.ZeInternals.SearchReplace.PCRE.Sequence
 import           Text.RE.ZeInternals.PCRE
+import           Text.RE.ZeInternals.SearchReplace.PCRE.Sequence
 import           Text.RE.ZeInternals.Types.IsRegex
 import           Text.Regex.Base
 import qualified Text.Regex.PCRE               as PCRE
diff --git a/src/Text/RE/PCRE/String.hs b/src/Text/RE/PCRE/String.hs
--- a/src/Text/RE/PCRE/String.hs
+++ b/src/Text/RE/PCRE/String.hs
@@ -59,14 +59,14 @@
   , module Text.RE.ZeInternals.SearchReplace.PCRE.String
   ) where
 
-import           Prelude.Compat
 
 import           Data.Typeable
+import           Prelude.Compat
 import           Text.RE.REOptions
 import           Text.RE.Replace
 import           Text.RE.ZeInternals.AddCaptureNames
-import           Text.RE.ZeInternals.SearchReplace.PCRE.String
 import           Text.RE.ZeInternals.PCRE
+import           Text.RE.ZeInternals.SearchReplace.PCRE.String
 import           Text.RE.ZeInternals.Types.IsRegex
 import           Text.Regex.Base
 import qualified Text.Regex.PCRE               as PCRE
diff --git a/src/Text/RE/TDFA/ByteString.hs b/src/Text/RE/TDFA/ByteString.hs
--- a/src/Text/RE/TDFA/ByteString.hs
+++ b/src/Text/RE/TDFA/ByteString.hs
@@ -59,9 +59,9 @@
   , module Text.RE.ZeInternals.SearchReplace.TDFA.ByteString
   ) where
 
-import           Prelude.Compat
 import qualified Data.ByteString               as B
 import           Data.Typeable
+import           Prelude.Compat
 import           Text.RE.REOptions
 import           Text.RE.Replace
 import           Text.RE.ZeInternals.AddCaptureNames
diff --git a/src/Text/RE/TDFA/ByteString/Lazy.hs b/src/Text/RE/TDFA/ByteString/Lazy.hs
--- a/src/Text/RE/TDFA/ByteString/Lazy.hs
+++ b/src/Text/RE/TDFA/ByteString/Lazy.hs
@@ -59,9 +59,9 @@
   , module Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy
   ) where
 
-import           Prelude.Compat
 import qualified Data.ByteString.Lazy.Char8    as LBS
 import           Data.Typeable
+import           Prelude.Compat
 import           Text.RE.REOptions
 import           Text.RE.Replace
 import           Text.RE.ZeInternals.AddCaptureNames
diff --git a/src/Text/RE/TDFA/Sequence.hs b/src/Text/RE/TDFA/Sequence.hs
--- a/src/Text/RE/TDFA/Sequence.hs
+++ b/src/Text/RE/TDFA/Sequence.hs
@@ -59,9 +59,9 @@
   , module Text.RE.ZeInternals.SearchReplace.TDFA.Sequence
   ) where
 
-import           Prelude.Compat
 import qualified Data.Sequence                 as S
 import           Data.Typeable
+import           Prelude.Compat
 import           Text.RE.REOptions
 import           Text.RE.Replace
 import           Text.RE.ZeInternals.AddCaptureNames
diff --git a/src/Text/RE/TDFA/String.hs b/src/Text/RE/TDFA/String.hs
--- a/src/Text/RE/TDFA/String.hs
+++ b/src/Text/RE/TDFA/String.hs
@@ -59,9 +59,9 @@
   , module Text.RE.ZeInternals.SearchReplace.TDFA.String
   ) where
 
-import           Prelude.Compat
 
 import           Data.Typeable
+import           Prelude.Compat
 import           Text.RE.REOptions
 import           Text.RE.Replace
 import           Text.RE.ZeInternals.AddCaptureNames
diff --git a/src/Text/RE/TDFA/Text.hs b/src/Text/RE/TDFA/Text.hs
--- a/src/Text/RE/TDFA/Text.hs
+++ b/src/Text/RE/TDFA/Text.hs
@@ -59,9 +59,9 @@
   , module Text.RE.ZeInternals.SearchReplace.TDFA.Text
   ) where
 
-import           Prelude.Compat
 import qualified Data.Text                     as T
 import           Data.Typeable
+import           Prelude.Compat
 import           Text.RE.REOptions
 import           Text.RE.Replace
 import           Text.RE.ZeInternals.AddCaptureNames
diff --git a/src/Text/RE/TDFA/Text/Lazy.hs b/src/Text/RE/TDFA/Text/Lazy.hs
--- a/src/Text/RE/TDFA/Text/Lazy.hs
+++ b/src/Text/RE/TDFA/Text/Lazy.hs
@@ -59,9 +59,9 @@
   , module Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy
   ) where
 
-import           Prelude.Compat
 import qualified Data.Text.Lazy                as TL
 import           Data.Typeable
+import           Prelude.Compat
 import           Text.RE.REOptions
 import           Text.RE.Replace
 import           Text.RE.ZeInternals.AddCaptureNames
