diff --git a/README.markdown b/README.markdown
--- a/README.markdown
+++ b/README.markdown
@@ -62,7 +62,7 @@
 
 &nbsp;&nbsp;&nbsp;&nbsp;&#x2612;&nbsp;&nbsp;2017-03-16  v0.8.0.0  [Tidy up the API](https://github.com/iconnect/regex/milestone/10)
 
-&nbsp;&nbsp;&nbsp;&nbsp;&#x2610;&nbsp;&nbsp;2017-03-18  v0.9.0.0  [Add type-safe replacement templates and use TemplateHaskellQuotes](https://github.com/iconnect/regex/milestone/9)
+&nbsp;&nbsp;&nbsp;&nbsp;&#x2612;&nbsp;&nbsp;2017-03-18  v0.9.0.0  [Finish tidying up the API, Add type-safe replacement templates and exploit TemplateHaskellQuotes](https://github.com/iconnect/regex/milestone/9)
 
 &nbsp;&nbsp;&nbsp;&nbsp;&#x2610;&nbsp;&nbsp;2017-03-31  v1.0.0.0  [First stable release](https://github.com/iconnect/regex/milestone/3)
 
@@ -103,10 +103,8 @@
 
 If you have any feedback or suggestion then please drop us a line.
 
-&nbsp;&nbsp;&nbsp;&nbsp;`t` [&#64;hregex](https://twitter.com/hregex)
-
-&nbsp;&nbsp;&nbsp;&nbsp;`e` maintainers@regex.uk
-
+&nbsp;&nbsp;&nbsp;&nbsp;`t` [&#64;hregex](https://twitter.com/hregex)\n
+&nbsp;&nbsp;&nbsp;&nbsp;`e` maintainers@regex.uk\n
 &nbsp;&nbsp;&nbsp;&nbsp;`w` http://issues.regex.uk
 
 The [Contact page](http://contact.regex.uk) has more details.
diff --git a/changelog b/changelog
--- a/changelog
+++ b/changelog
@@ -1,5 +1,16 @@
 -*-change-log-*-
 
+0.9.0.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-03-23
+  * Flip the order of the arguments to replace (#78)
+  * Add type-safe replacement templates (#60)
+  * Finish tidying up the API (#80)
+  * Make `regex` compatible w/ TH-less GHCs (#70)
+  * Declare extensions the compiler must support (#83)
+  * Fix curl for AppVeyor build (#79)
+  * Fix AppVeyor badge (#81)
+  * Remove QQ from code coverage stats (#82)
+  * Rename Options, Context and Replace methods (#84)
+
 0.8.0.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-03-16
   * Tidy up the API after recent reorganization (#76)
 
diff --git a/examples/TestKit.lhs b/examples/TestKit.lhs
--- a/examples/TestKit.lhs
+++ b/examples/TestKit.lhs
@@ -38,11 +38,12 @@
 import           System.Exit
 import           System.IO
 import           Text.Printf
-import           Text.RE.Types.IsRegex
 import           Text.RE.TDFA
 import           Text.RE.TestBench.Parsers
 import           Text.RE.Tools.Grep
 import           Text.RE.Tools.Sed
+import           Text.RE.Types.Match
+import           Text.RE.Types.Replace
 \end{code}
 
 
@@ -93,7 +94,7 @@
 
 substVersion_ :: (IsRegex RE a,Replace a) => a -> IO a
 substVersion_ txt =
-    flip replaceAll ms . packE . presentVrn <$> readCurrentVersion
+    flip replaceAll ms . packR . presentVrn <$> readCurrentVersion
   where
     ms = txt *=~ [re|<<\$version\$>>|]
 
@@ -178,8 +179,8 @@
 \begin{code}
 include :: LBS.ByteString -> IO LBS.ByteString
 include = sed' $ Select
-    [ (,) [re|^%include ${file}(@{%string})$|] $ Function TOP   incl
-    , (,) [re|^.*$|]                           $ Function TOP $ \_ _ _ _->return Nothing
+    [ Function [re|^%include ${file}(@{%string})$|] TOP   incl
+    , Function [re|^.*$|]                           TOP $ \_ _ _ _->return Nothing
     ]
   where
     incl _ mtch _ _ = Just <$> LBS.readFile (prs_s $ mtch !$$ [cp|file|])
diff --git a/examples/re-gen-cabals.lhs b/examples/re-gen-cabals.lhs
--- a/examples/re-gen-cabals.lhs
+++ b/examples/re-gen-cabals.lhs
@@ -41,6 +41,8 @@
 import           Text.RE.TDFA.Text                        as T
 import           Text.RE.Tools.Grep
 import           Text.RE.Tools.Sed
+import           Text.RE.Types.Match
+import           Text.RE.Types.Matches
 
 
 main :: IO ()
@@ -107,15 +109,16 @@
 
 gc_script :: Ctx -> Edits IO RE LBS.ByteString
 gc_script ctx = Select
-    [ (,) [re|^%Werror$|]                                      $ LineEdit $ w_error_gen              ctx
-    , (,) [re|^%Wwarn$|]                                       $ LineEdit $ w_warn_gen               ctx
-    , (,) [re|^%filter-regex-with-pcre$|]                      $ LineEdit $ w_filter_pcre            ctx
-    , (,) [re|^%- +${pkg}(@{%id-}) +${cond}(.*)$|]             $ LineEdit $ cond_gen                 ctx
-    , (,) [re|^%build-depends +${list}(@{%id-}( +@{%id-})+)$|] $ LineEdit $ build_depends_gen        ctx
-    , (,) [re|^%test +${i}(@{%id-})$|]                         $ LineEdit $ test_exe_gen True  False ctx
-    , (,) [re|^%exe +${i}(@{%id-})$|]                          $ LineEdit $ test_exe_gen False True  ctx
-    , (,) [re|^%test-exe +${i}(@{%id-})$|]                     $ LineEdit $ test_exe_gen True  True  ctx
-    , (,) [re|^.*$|]                                           $ LineEdit $ default_gen              ctx
+    [ LineEdit [re|^%Werror$|]                            $ w_error_gen              ctx
+    , LineEdit [re|^%Wwarn$|]                             $ w_warn_gen               ctx
+    , LineEdit [re|^%filter-regex-with-pcre$|]            $ w_filter_pcre            ctx
+    , LineEdit [re|^%- +${pkg}(@{%id-}) +${cond}(.*)$|]   $ cond_gen                 ctx
+    , LineEdit [re|^%build-depends-${lb}(lib|prog) +${list}(@{%id-}( +@{%id-})+)$|]
+                                                          $ build_depends_gen        ctx
+    , LineEdit [re|^%test +${i}(@{%id-})$|]               $ test_exe_gen True  False ctx
+    , LineEdit [re|^%exe +${i}(@{%id-})$|]                $ test_exe_gen False True  ctx
+    , LineEdit [re|^%test-exe +${i}(@{%id-})$|]           $ test_exe_gen True  True  ctx
+    , LineEdit [re|^.*$|]                                 $ default_gen              ctx
     ]
 
 w_error_gen, w_warn_gen, w_filter_pcre, cond_gen, build_depends_gen,
@@ -141,8 +144,9 @@
     we <- readIORef _ctx_w_error
     fp <- readIORef _ctx_filter_pcre
     mp <- readIORef _ctx_package_constraints
-    put ctx $ mk_build_depends we fp mp lst
+    put ctx $ mk_build_depends lb we fp mp lst
   where
+    lb   = captureText [cp|lb|] mtch == "lib"
     lst  = LBS.words $ captureText [cp|list|] mtch
     mtch = allMatches mtchs !! 0
 
@@ -208,12 +212,41 @@
 
 mk_build_depends :: Bool
                  -> Bool
+                 -> Bool
                  -> Map.Map LBS.ByteString LBS.ByteString
                  -> [LBS.ByteString]
                  -> LBS.ByteString
-mk_build_depends we fp mp pks0 = LBS.unlines $
+mk_build_depends lb we fp mp pks0 = LBS.unlines $
         [ "    Default-Language:   Haskell2010"
-        , "    GHC-Options:"
+        , ""
+        ] ++ filter (if lb then const True else const False)
+        [ "    Other-Extensions:"
+        , "      AllowAmbiguousTypes"
+        , "      CPP"
+        , "      DeriveDataTypeable"
+        , "      DeriveGeneric"
+        , "      ExistentialQuantification"
+        , "      FlexibleContexts"
+        , "      FlexibleInstances"
+        , "      FunctionalDependencies"
+        , "      GeneralizedNewtypeDeriving"
+        , "      MultiParamTypeClasses"
+        , "      NoImplicitPrelude"
+        , "      OverloadedStrings"
+        , "      QuasiQuotes"
+        , "      RecordWildCards"
+        , "      ScopedTypeVariables"
+        , "      TemplateHaskell"
+        , "      TypeSynonymInstances"
+        , "      UndecidableInstances"
+        , ""
+        , "    if !impl(ghc >= 8.0)"
+        , "      Other-Extensions: TemplateHaskell"
+        , "    else"
+        , "      Other-Extensions: TemplateHaskellQuotes"
+        , ""
+        ] ++
+        [ "    GHC-Options:"
         , "      -Wall"
         , "      -fwarn-tabs"
         , "      " <> w_error_or_warn
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
@@ -27,6 +27,7 @@
 import           System.IO
 import           Text.RE.TDFA.ByteString.Lazy
 import           Text.RE.Tools.Sed
+import           Text.RE.Types.SearchReplace
 
 
 main :: IO ()
@@ -94,9 +95,9 @@
           -> (ModPath,SedScript)
 tdfa_edit mp bs_lbs import_lbs =
     (,) mp $ Pipe
-        [ (,) module_re $ Template $ LBS.pack mp
-        , (,) import_re $ Template   import_lbs
-        , (,) bs_re     $ Template   bs_lbs
+        [ Template $ SearchReplace module_re $ LBS.pack mp
+        , Template $ SearchReplace import_re   import_lbs
+        , Template $ SearchReplace bs_re       bs_lbs
         ]
 
 pcre_edit :: ModPath
@@ -105,10 +106,10 @@
           -> (ModPath,SedScript)
 pcre_edit mp bs_lbs import_lbs =
     (,) mp $ Pipe
-        [ (,) tdfa_re   $ Template   "PCRE"
-        , (,) module_re $ Template $ LBS.pack mp
-        , (,) import_re $ Template   import_lbs
-        , (,) bs_re     $ Template   bs_lbs
+        [ Template $ SearchReplace tdfa_re     "PCRE"
+        , Template $ SearchReplace module_re $ LBS.pack mp
+        , Template $ SearchReplace import_re   import_lbs
+        , Template $ SearchReplace bs_re       bs_lbs
         ]
 
 type ModPath = String
diff --git a/examples/re-include.lhs b/examples/re-include.lhs
--- a/examples/re-include.lhs
+++ b/examples/re-include.lhs
@@ -36,6 +36,9 @@
 import           Text.RE.TestBench.Parsers
 import           Text.RE.Tools.Grep
 import           Text.RE.Tools.Sed
+import           Text.RE.Types.Capture
+import           Text.RE.Types.Match
+import           Text.RE.Types.Replace
 \end{code}
 
 \begin{code}
@@ -67,8 +70,8 @@
 loop :: FilePath -> FilePath -> IO ()
 loop =
   sed $ Select
-    [ (,) [re|^%include ${file}(@{%string}) ${rex}(@{%string})$|] $ Function TOP   include_file
-    , (,) [re|^.*$|]                                              $ Function TOP $ \_ _ _ _->return Nothing
+    [ Function [re|^%include ${file}(@{%string}) ${rex}(@{%string})$|] TOP include_file
+    , Function [re|^.*$|]                                              TOP $ \_ _ _ _->return Nothing
     ]
 \end{code}
 
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
@@ -42,11 +42,14 @@
 import           System.Exit
 import           System.IO
 import           Text.RE.Tools.Sed
-import           Text.RE.Types.Options
+import           Text.RE.Types.REOptions
 import           Text.RE.TestBench.Parsers
 import           Text.RE.TestBench
 import           Text.RE.PCRE.ByteString.Lazy
 import qualified Text.RE.PCRE.String                      as S
+import           Text.RE.Types.Capture
+import           Text.RE.Types.Match
+import           Text.RE.Types.Replace
 import           Text.Printf
 \end{code}
 
@@ -133,8 +136,7 @@
     , on [re_|.*|]            QQQ parse_def
     ]
   where
-    on rex src prs =
-      (,) (rex lpo) $ Function TOP $ process_line ctx src prs
+    on rex src prs = Function (rex lpo) TOP $ process_line ctx src prs
 
     parse_def      = fmap capturedText . matchCapture
 \end{code}
@@ -264,16 +266,16 @@
 
 
 --
--- Options and Prelude
+-- REOptions and Prelude
 --
 
-lpo :: Options
-lpo = makeOptions lp_prelude
+lpo :: REOptions
+lpo = makeREOptions lp_prelude
 
 lp_prelude :: Macros RE
 lp_prelude = runIdentity $ mkMacros mk regexType ExclCaptures lp_env
   where
-    mk   = maybe oops Identity . compileRegexWithOptions noPreludeOptions
+    mk   = maybe oops Identity . compileRegexWithOptions noPreludeREOptions
 
     oops = error "lp_prelude"
 
@@ -569,7 +571,7 @@
   deriving (IsString,Ord,Eq,Show)
 
 parse_user :: Replace a => a -> Maybe User
-parse_user = Just . User . LBS.pack . unpackE
+parse_user = Just . User . LBS.pack . unpackR
 
 
 --
@@ -577,7 +579,7 @@
 --
 
 parse_pid_tid :: Replace a => a -> Maybe (Int,Int)
-parse_pid_tid x = case allMatches $ unpackE x S.*=~ [re|@{%nat}|] of
+parse_pid_tid x = case allMatches $ unpackR x S.*=~ [re|@{%nat}|] of
     [cs,cs'] -> (,) <$> p cs <*> p cs'
     _        -> Nothing
   where
diff --git a/examples/re-prep.lhs b/examples/re-prep.lhs
--- a/examples/re-prep.lhs
+++ b/examples/re-prep.lhs
@@ -42,6 +42,9 @@
 import           Text.RE.Tools.Sed
 import           Text.RE.TDFA.ByteString.Lazy
 import qualified Text.RE.TDFA.Text                        as TT
+import           Text.RE.Types.Capture
+import           Text.RE.Types.Match
+import           Text.RE.Types.Replace
 \end{code}
 
 \begin{code}
@@ -113,11 +116,11 @@
 prep_tut :: MODE -> FilePath -> FilePath -> IO ()
 prep_tut mode =
   sed $ Select
-    [ (,) [re|^%include ${file}(@{%string}) ${rex}(@{%string})$|] $ Function TOP $ inclde   mode
-    , (,) [re|^%main ${arg}(top|bottom)$|]                        $ LineEdit     $ main_    mode
-    , (,) [re|^${fn}(evalme@{%id}) = checkThis ${arg}(@{%string}) \(${ans}([^)]+)\) \$ *${exp}(.*)$|]
-                                                                  $ Function TOP $ evalme   mode
-    , (,) [re|^.*$|]                                              $ Function TOP $ passthru
+    [ Function [re|^%include ${file}(@{%string}) ${rex}(@{%string})$|] TOP $ inclde   mode
+    , LineEdit [re|^%main ${arg}(top|bottom)$|]                            $ main_    mode
+    , Function [re|^${fn}(evalme@{%id}) = checkThis ${arg}(@{%string}) \(${ans}([^)]+)\) \$ *${exp}(.*)$|]
+                                                                       TOP $ evalme   mode
+    , Function [re|^.*$|]                                              TOP $ passthru
     ]
 \end{code}
 
@@ -176,7 +179,7 @@
     pd "RE/Types/Match"
     pd "RE/Types/Capture"
     pd "RE/Types/IsRegex"
-    pd "RE/Types/Options"
+    pd "RE/Types/REOptions"
     pd "RE/Types/Replace"
     pd "RE/TestBench"
     pd "RE/Tools/Edit"
@@ -231,7 +234,7 @@
           -> Location
           -> Capture LBS.ByteString
           -> IO (Maybe LBS.ByteString)
-evalmeDoc _ mtch _ _ = return $ Just $ replace mtch $ LBS.intercalate "\n"
+evalmeDoc _ mtch _ _ = return $ Just $ flip replace mtch $ LBS.intercalate "\n"
   [ "ghci> ${exp}"
   , "${ans}"
   ]
@@ -378,7 +381,7 @@
     mapM_ collect
       [ (,) "license"             "https://img.shields.io/badge/license-BSD3-brightgreen.svg"
       , (,) "unix-build"          "https://img.shields.io/travis/iconnect/regex.svg?label=Linux%2BmacOS"
-      , (,) "windows-build"       "https://img.shields.io/appveyor/ci/engineerirngirisconnectcouk/regex.svg?label=Windows"
+      , (,) "windows-build"       "https://img.shields.io/appveyor/ci/cdornan/regex.svg?label=Windows"
       , (,) "coverage"            "https://img.shields.io/coveralls/iconnect/regex.svg"
       , (,) "build-status"        "https://img.shields.io/travis/iconnect/regex.svg?label=Build%20Status"
       , (,) "maintainers-contact" "https://img.shields.io/badge/email-maintainers%40regex.uk-blue.svg"
@@ -506,7 +509,7 @@
 
 set_title :: LBS.ByteString -> LBS.ByteString -> LBS.ByteString
 set_title ttl lbs = fromMaybe oops $ flip sed' lbs $ Pipe
-    [ (,) [re|<<\$title\$>>|] $ Function TOP $ \_ _ _ _->return $ Just ttl
+    [ Function [re|<<\$title\$>>|] TOP $ \_ _ _ _->return $ Just ttl
     ]
   where
     -- runIdentity added to base in 4.9 only
@@ -522,10 +525,10 @@
     return (hdgs,lbs1<>lbs2)
   where
     scr rf_h rf_t = Select
-      [ (,) [re|^%heading#${ide}(@{%id}) +${ttl}([^ ].*)$|] $ Function TOP $ heading       mmd rf_t rf_h
-      , (,) [re|^- \[ \] +${itm}(.*)$|]                     $ Function TOP $ task_list     mmd rf_t False
-      , (,) [re|^- \[[Xx]\] +${itm}(.*)$|]                  $ Function TOP $ task_list     mmd rf_t True
-      , (,) [re|^.*$|]                                      $ Function TOP $ fin_task_list mmd rf_t
+      [ Function [re|^%heading#${ide}(@{%id}) +${ttl}([^ ].*)$|] TOP $ heading       mmd rf_t rf_h
+      , Function [re|^- \[ \] +${itm}(.*)$|]                     TOP $ task_list     mmd rf_t False
+      , Function [re|^- \[[Xx]\] +${itm}(.*)$|]                  TOP $ task_list     mmd rf_t True
+      , Function [re|^.*$|]                                      TOP $ fin_task_list mmd rf_t
       ]
 
 heading :: MarkdownMode
@@ -710,7 +713,7 @@
                     LBS.unlines
                       [ "---"
                       , "title: "<>LBS.fromStrict (TE.encodeUtf8 title)
-                      ,"---"
+                      , "---"
                       ]
   LBS.writeFile "tmp/bc.html" bc
   LBS.writeFile "tmp/ft.html" ft
@@ -764,10 +767,10 @@
 tweak_md mm lbs = case mm of
     MM_github  -> lbs
     MM_pandoc  -> awk
-      [ (,) [re|<https?://${rest}([^)]+)>|] $ Template "[${rest}]($0)"
+      [ Template [ed|<https?://${rest}([^)]+)>///[${rest}]($0)|]
       ]
     MM_hackage -> awk
-      [ (,) [re|<br/>$|] $ Template "\n"
+      [ Template [ed|<br/>$///\n|]
       ]
   where
     awk = fromMaybe oops . flip sed' lbs . Pipe
diff --git a/examples/re-tests.lhs b/examples/re-tests.lhs
--- a/examples/re-tests.lhs
+++ b/examples/re-tests.lhs
@@ -16,6 +16,9 @@
 {-# LANGUAGE MultiParamTypeClasses      #-}
 {-# LANGUAGE FlexibleInstances          #-}
 {-# LANGUAGE TemplateHaskell            #-}
+{-# LANGUAGE FlexibleContexts           #-}
+{-# LANGUAGE DeriveFunctor              #-}
+{-# LANGUAGE StandaloneDeriving         #-}
 {-# OPTIONS_GHC -fno-warn-orphans       #-}
 
 module Main (main) where
@@ -46,13 +49,17 @@
 import           Text.RE.Internal.AddCaptureNames
 import           Text.RE.Internal.NamedCaptures
 import           Text.RE.Internal.PreludeMacros
-import           Text.RE.Internal.QQ
 import qualified Text.RE.PCRE                   as PCRE
 import           Text.RE.TDFA                   as TDFA
+import           Text.RE.SearchReplace
 import           Text.RE.TestBench
+import           Text.RE.Tools.Sed
+import           Text.RE.Types.Capture
 import           Text.RE.Types.CaptureID
-import           Text.RE.Types.IsRegex
-import           Text.RE.Types.Options
+import           Text.RE.Types.Match
+import           Text.RE.Types.Matches
+import           Text.RE.Types.REOptions
+import           Text.RE.Types.Replace
 
 import qualified Text.RE.PCRE.String            as P_ST
 import qualified Text.RE.PCRE.ByteString        as P_BS
@@ -73,13 +80,14 @@
 main = defaultMain $
   testGroup "Tests"
     [ prelude_tests
-    , parsing_tests
+    , compiling_tests
     , core_tests
-    , replaceMethodstests
+    , replace_methods_tests
+    , search_replace_tests
     , options_tests
-    , namedCapturesTestTree
+    , named_capture_tests
     , many_tests
-    , escapeTests
+    , escape_tests
     , add_capture_names_tests
     , misc_tests
     ]
@@ -205,8 +213,8 @@
 <h3>testing the compileRegex functions</h3>
 
 \begin{code}
-parsing_tests :: TestTree
-parsing_tests = testGroup "Parsing"
+compiling_tests :: TestTree
+compiling_tests = testGroup "Compiling"
   [ testCase "complete check (matchM/ByteString)" $ do
       r <- TDFA.compileRegex $ reSource regex_
       assertEqual "Match" (B.pack <$> regex_str_match) $ B.pack str_ ?=~ r
@@ -231,18 +239,20 @@
             r <- mk re_s
             assertEqual "RE" re_s $ regexSource r
         , testCase "Match" $ do
-            r <- mk re_s
+            r <- mk' re_s
             assertEqual "Match" (pk <$> regex_str_match) $ matchOnce r $ pk str_
         ]
       where
-        mk   = makeRegex `asTypeOf` mk0
+        mk   = makeRegex              `asTypeOf` mk0
 
+        mk'  = makeRegexWith minBound `asTypeOf` mk0
+
         re_s = pk $ reSource regex_
 
         pk   = mk_pk mk0
 
         mk_pk :: Replace s' => (s'->IO re') -> String -> s'
-        mk_pk _ = packE
+        mk_pk _ = packR
 \end{code}
 
 <h3>core tests</h3>
@@ -281,8 +291,8 @@
 <h3>testing the replace functions at different types</h3>
 
 \begin{code}
-replaceMethodstests :: TestTree
-replaceMethodstests = testGroup "Replace"
+replace_methods_tests :: TestTree
+replace_methods_tests = testGroup "Replace"
   [ testCase "String/single" $ do
       let m = str_ =~ regex_ :: Match String
           r = replaceCaptures ALL fmt m
@@ -328,18 +338,98 @@
         "(0:0:(0:1:a) (0:2:bbbb)) (1:0:(1:1:aa) (1:2:b))"
 
     fmt :: (IsString s,Replace s) => a -> Location -> Capture s -> Maybe s
-    fmt _ (Location i j) Capture{..} = Just $ "(" <> packE (show i) <> ":" <>
-      packE (show_co j) <> ":" <> capturedText <> ")"
+    fmt _ (Location i j) Capture{..} = Just $ "(" <> packR (show i) <> ":" <>
+      packR (show_co j) <> ":" <> capturedText <> ")"
 
     show_co (CaptureOrdinal j) = show j
 \end{code}
 
-<h3>Testing The Options</h3>
 
+<h3>SearchReplace</h3>
+
 \begin{code}
+search_replace_tests :: TestTree
+search_replace_tests = testGroup "SearchReplace"
+    [ testCase "TDFA.ed/String" $ test  id         tdfa_eds
+    , testCase "PCRE.ed/String" $ test  id         pcre_eds
+    , testCase "TDFA.ed/B"      $ test  B.pack     tdfa_eds
+    , testCase "PCRE.ed/B"      $ test  B.pack     pcre_eds
+    , testCase "TDFA.ed/LBS"    $ test  LBS.pack   tdfa_eds
+    , testCase "PCRE.ed/LBS"    $ test  LBS.pack   pcre_eds
+    , testCase "TDFA.ed/S"      $ test  S.fromList tdfa_eds
+    , testCase "PCRE.ed/S"      $ test  S.fromList pcre_eds
+    , testCase "TDFA.ed/T"      $ test  T.pack     tdfa_eds
+    , testCase "TDFA.ed/LT"     $ test  LT.pack    tdfa_eds
+    , testCase "TDFA.ed/T(d)"   $ test  T.pack     tdfa_eds'
+    , testCase "PCRE.ed/LBS(d)" $ test  LBS.pack   pcre_eds'
+    , testg "TDFA.op/String" (T_ST.?=~/) (T_ST.*=~/) tdfa_sr
+    , testg "PCRE.op/String" (P_ST.?=~/) (P_ST.*=~/) pcre_sr
+    , testg "TDFA.op/B"      (T_BS.?=~/) (T_BS.*=~/) tdfa_sr
+    , testg "PCRE.op/B"      (P_BS.?=~/) (P_BS.*=~/) pcre_sr
+    , testg "TDFA.op/LBS"    (TLBS.?=~/) (TLBS.*=~/) tdfa_sr
+    , testg "PCRE.op/LBS"    (PLBS.?=~/) (PLBS.*=~/) pcre_sr
+    , testg "TDFA.op/T"      (T_TX.?=~/) (T_TX.*=~/) tdfa_sr
+    , testg "TDFA.op/LT"     (TLTX.?=~/) (TLTX.*=~/) tdfa_sr
+    , testG "TDFA.op/S"      (T_SQ.?=~/) (T_SQ.*=~/) tdfa_sr
+    , testG "PCRE.op/S"      (P_SQ.?=~/) (P_SQ.*=~/) pcre_sr
+    ]
+  where
+    test :: IsRegex re a => (String->a) -> Edits Identity re a -> Assertion
+    test inj eds =  inj rsm @=? runIdentity (sed' eds $ inj inp)
+
+    testg lab op1 opm sr = testGroup lab
+      [ testCase "?=~/" $ rs1 @=? inp `op1` sr
+      , testCase "*=~/" $ rsm @=? inp `opm` sr
+      ]
+
+    testG lab op1 opm sr = testGroup lab
+      [ testCase "?=~/" $ S.fromList rs1 @=? S.fromList inp `op1` sr
+      , testCase "*=~/" $ S.fromList rsm @=? S.fromList inp `opm` sr
+      ]
+
+    inp, rs1, rsm :: IsString a => a
+    inp = "16/03/2017 01/01/2000\n"
+    rs1 = "2017-03-16 01/01/2000\n"
+    rsm = "2017-03-16 2000-01-01\n"
+
+    tdfa_eds :: IsRegex TDFA.RE a => Edits Identity TDFA.RE a
+    tdfa_eds = Select [Template tdfa_sr]
+
+    pcre_eds :: IsRegex PCRE.RE a => Edits Identity PCRE.RE a
+    pcre_eds = Select [Template pcre_sr]
+
+    tdfa_sr  :: IsRegex TDFA.RE a => SearchReplace TDFA.RE a
+    tdfa_sr  = [TDFA.ed|${d}([0-9]{2})/${m}([0-9]{2})/${y}([0-9]{4})///${y}-${m}-${d}|]
+
+    pcre_sr  :: IsRegex PCRE.RE a => SearchReplace PCRE.RE a
+    pcre_sr  = [PCRE.ed|${d}([0-9]{2})/${m}([0-9]{2})/${y}([0-9]{4})///${y}-${m}-${d}|]
+
+    tdfa_eds' :: IsRegex TDFA.RE a => Edits Identity TDFA.RE a
+    tdfa_eds' = Select [Template $ tdfa_csr "${d}([0-9]{2})/${m}([0-9]{2})/${y}([0-9]{4})" "${y}-${m}-${d}"]
+
+    pcre_eds' :: IsRegex PCRE.RE a => Edits Identity PCRE.RE a
+    pcre_eds' = Select [Template $ pcre_csr "${d}([0-9]{2})/${m}([0-9]{2})/${y}([0-9]{4})" "${y}-${m}-${d}"]
+
+    tdfa_csr :: IsRegex TDFA.RE s
+             => String
+             -> String
+             -> SearchReplace TDFA.RE s
+    tdfa_csr re_s = either error id . TDFA.compileSearchReplace re_s
+
+    pcre_csr :: IsRegex PCRE.RE s
+             => String
+             -> String
+             -> SearchReplace PCRE.RE s
+    pcre_csr re_s = either error id . PCRE.compileSearchReplace re_s
+\end{code}
+
+
+<h3>Testing The REOptions</h3>
+
+\begin{code}
 options_tests :: TestTree
-options_tests = testGroup "Simple Options"
-  [ testGroup "TDFA Simple Options"
+options_tests = testGroup "Simple REOptions"
+  [ testGroup "TDFA Simple REOptions"
       [ testCase "default (MultilineSensitive)" $ assertEqual "#" 2 $
           countMatches $ s TDFA.*=~ [TDFA.re|[0-9a-f]{2}$|]
       , testCase "MultilineSensitive" $ assertEqual "#" 2 $
@@ -351,7 +441,7 @@
       , testCase "BlockInsensitive" $ assertEqual "#" 1 $
           countMatches $ s TDFA.*=~ [TDFA.reBlockInsensitive|[0-9a-f]{2}$|]
       ]
-  , testGroup "PCRE Simple Options"
+  , testGroup "PCRE Simple REOptions"
       [ testCase "default (MultilineSensitive)" $ assertEqual "#" 2 $
           countMatches $ s PCRE.*=~ [PCRE.re|[0-9a-f]{2}$|]
       , testCase "MultilineSensitive" $ assertEqual "#" 2 $
@@ -374,37 +464,39 @@
 \begin{code}
 many_tests :: TestTree
 many_tests = testGroup "Many Tests"
-    [ testCase "PCRE a"               $ test (PCRE.*=~) (PCRE.?=~) (PCRE.=~) (PCRE.=~~) matchOnce matchMany id          re_pcre
-    , testCase "PCRE ByteString"      $ test (P_BS.*=~) (P_BS.?=~) (P_BS.=~) (P_BS.=~~) matchOnce matchMany B.pack      re_pcre
-    , testCase "PCRE ByteString.Lazy" $ test (PLBS.*=~) (PLBS.?=~) (PLBS.=~) (PLBS.=~~) matchOnce matchMany LBS.pack    re_pcre
-    , testCase "PCRE Sequence"        $ test (P_SQ.*=~) (P_SQ.?=~) (P_SQ.=~) (P_SQ.=~~) matchOnce matchMany S.fromList  re_pcre
-    , testCase "PCRE String"          $ test (P_ST.*=~) (P_ST.?=~) (P_ST.=~) (P_ST.=~~) matchOnce matchMany id          re_pcre
-    , testCase "TDFA a"               $ test (TDFA.*=~) (TDFA.?=~) (TDFA.=~) (TDFA.=~~) matchOnce matchMany id          re_tdfa
-    , testCase "TDFA ByteString"      $ test (T_BS.*=~) (T_BS.?=~) (T_BS.=~) (T_BS.=~~) matchOnce matchMany B.pack      re_tdfa
-    , testCase "TDFA ByteString.Lazy" $ test (TLBS.*=~) (TLBS.?=~) (TLBS.=~) (TLBS.=~~) matchOnce matchMany LBS.pack    re_tdfa
-    , testCase "TDFA Sequence"        $ test (T_SQ.*=~) (T_SQ.?=~) (T_SQ.=~) (T_SQ.=~~) matchOnce matchMany S.fromList  re_tdfa
-    , testCase "TDFA String"          $ test (T_ST.*=~) (T_ST.?=~) (T_ST.=~) (T_ST.=~~) matchOnce matchMany id          re_tdfa
-    , testCase "TDFA Text"            $ test (T_TX.*=~) (T_TX.?=~) (T_TX.=~) (T_TX.=~~) matchOnce matchMany T.pack      re_tdfa
-    , testCase "TDFA Text.Lazy"       $ test (TLTX.*=~) (TLTX.?=~) (TLTX.=~) (TLTX.=~~) matchOnce matchMany LT.pack     re_tdfa
+    [ testCase "PCRE a"               $ test (PCRE.*=~) (PCRE.?=~) (PCRE.=~) (PCRE.=~~) matchOnce matchMany makeSearchReplace id          re_pcre
+    , testCase "PCRE ByteString"      $ test (P_BS.*=~) (P_BS.?=~) (P_BS.=~) (P_BS.=~~) matchOnce matchMany makeSearchReplace B.pack      re_pcre
+    , testCase "PCRE ByteString.Lazy" $ test (PLBS.*=~) (PLBS.?=~) (PLBS.=~) (PLBS.=~~) matchOnce matchMany makeSearchReplace LBS.pack    re_pcre
+    , testCase "PCRE Sequence"        $ test (P_SQ.*=~) (P_SQ.?=~) (P_SQ.=~) (P_SQ.=~~) matchOnce matchMany makeSearchReplace S.fromList  re_pcre
+    , testCase "PCRE String"          $ test (P_ST.*=~) (P_ST.?=~) (P_ST.=~) (P_ST.=~~) matchOnce matchMany makeSearchReplace id          re_pcre
+    , testCase "TDFA a"               $ test (TDFA.*=~) (TDFA.?=~) (TDFA.=~) (TDFA.=~~) matchOnce matchMany makeSearchReplace id          re_tdfa
+    , testCase "TDFA ByteString"      $ test (T_BS.*=~) (T_BS.?=~) (T_BS.=~) (T_BS.=~~) matchOnce matchMany makeSearchReplace B.pack      re_tdfa
+    , testCase "TDFA ByteString.Lazy" $ test (TLBS.*=~) (TLBS.?=~) (TLBS.=~) (TLBS.=~~) matchOnce matchMany makeSearchReplace LBS.pack    re_tdfa
+    , testCase "TDFA Sequence"        $ test (T_SQ.*=~) (T_SQ.?=~) (T_SQ.=~) (T_SQ.=~~) matchOnce matchMany makeSearchReplace S.fromList  re_tdfa
+    , testCase "TDFA String"          $ test (T_ST.*=~) (T_ST.?=~) (T_ST.=~) (T_ST.=~~) matchOnce matchMany makeSearchReplace id          re_tdfa
+    , testCase "TDFA Text"            $ test (T_TX.*=~) (T_TX.?=~) (T_TX.=~) (T_TX.=~~) matchOnce matchMany makeSearchReplace T.pack      re_tdfa
+    , testCase "TDFA Text.Lazy"       $ test (TLTX.*=~) (TLTX.?=~) (TLTX.=~) (TLTX.=~~) matchOnce matchMany makeSearchReplace LT.pack     re_tdfa
     ]
   where
-    test :: (Show s,Eq s)
+    test :: (IsRegex r s,Show s,Eq s)
          => (s->r->Matches s)
          -> (s->r->Match   s)
          -> (s->r->Matches s)
          -> (s->r->Maybe(Match s))
          -> (r->s->Match   s)
          -> (r->s->Matches s)
+         -> (s->s->Either String (SearchReplace r s))
          -> (String->s)
          -> r
          -> Assertion
-    test (%*=~) (%?=~) (%=~) (%=~~) mo mm inj r = do
+    test (%*=~) (%?=~) (%=~) (%=~~) mo mm mk_sr0 inj r = do
         2         @=? countMatches mtchs
         Just txt' @=? matchedText  mtch
         mtchs     @=? mtchs'
         mb_mtch   @=? Just mtch
         mtch      @=? mtch''
         mtchs     @=? mtchs''
+        txt''     @=? searchReplaceAll (mk_sr re_t tpl) txt
       where
         mtchs   = txt %*=~ r
         mtch    = txt %?=~ r
@@ -413,12 +505,21 @@
         mtch''  = mo r txt
         mtchs'' = mm r txt
 
+        re_t    = inj re_s
+        tpl     = inj "${d}/${m}/${y}"
+
         txt     = inj "2016-01-09 2015-12-5 2015-10-05"
         txt'    = inj "2016-01-09"
+        txt''   = inj "09/01/2016 2015-12-5 05/10/2015"
 
+        mk_sr   = \r_ t_ -> either error id $ mk_sr0 r_ t_
+
+
     re_pcre = fromMaybe oops $ PCRE.compileRegex "[0-9]{4}-[0-9]{2}-[0-9]{2}"
     re_tdfa = fromMaybe oops $ TDFA.compileRegex "[0-9]{4}-[0-9]{2}-[0-9]{2}"
 
+    re_s    = "${y}([0-9]{4})-${m}([0-9]{2})-${d}([0-9]{2})"
+
     oops    = error "many_tests"
 \end{code}
 
@@ -427,8 +528,8 @@
 -------------------------------
 
 \begin{code}
-escapeTests :: TestTree
-escapeTests = testGroup "Escape Tests"
+escape_tests :: TestTree
+escape_tests = testGroup "Escape Tests"
     [ testGroup "PCRE"
         [ testCase  "Escaping empty string" $
             assertBool "empty string" $
@@ -453,11 +554,13 @@
         ]
     ]
   where
-    tst :: ((String->String)->String->a)
+    tst :: ((String->String)->String->Either String a)
         -> (String->a->Match String)
         -> String
         -> Bool
-    tst esc (%=~) s = matched $ s %=~ esc (("^" ++) . (++ "$")) s
+    tst esc0 (%=~) s = matched $ s %=~ esc s
+      where
+        esc = un_either . esc0 (("^" ++) . (++ "$"))
 
     metacharacters :: String
     metacharacters = "^\\.|*+?()[]{}$"
@@ -468,8 +571,8 @@
 -------------------
 
 \begin{code}
-namedCapturesTestTree :: TestTree
-namedCapturesTestTree = localOption (SmallCheckDepth 4) $
+named_capture_tests :: TestTree
+named_capture_tests = localOption (SmallCheckDepth 4) $
   testGroup "NamedCaptures"
     [ formatScanTestTree
     , analyseTokensTestTree
@@ -484,9 +587,9 @@
         SC.testProperty "formatTokens == formatTokens0" $
           \tks -> formatTokens tks == formatTokens0 tks
     , localOption (SmallCheckDepth 4) $
-        SC.testProperty "scan . formatTokens' idFormatTokenOptions == id" $
+        SC.testProperty "scan . formatTokens' idFormatTokenREOptions == id" $
           \tks -> all validToken tks ==>
-                    scan (formatTokens' idFormatTokenOptions tks) == tks
+                    scan (formatTokens' idFormatTokenREOptions tks) == tks
     ]
 
 analyseTokensTestTree :: TestTree
@@ -516,7 +619,7 @@
               ]
         )
 
-    xnc = either oops fst . extractNamedCaptures
+    xnc = either oops (snd . fst) . extractNamedCaptures
       where
         oops = error "analyseTokensTestTree: unexpected parse failure"
 \end{code}
@@ -569,12 +672,33 @@
 \begin{code}
 misc_tests :: TestTree
 misc_tests = testGroup "Miscelaneous Tests"
-    [ testGroup "QQ"
-        [ qq_tc "expression"  quoteExp
-        , qq_tc "pattern"     quotePat
-        , qq_tc "type"        quoteType
-        , qq_tc "declaration" quoteDec
+    [ testGroup "CaptureID"
+        [ testCase "CaptureID lookup failure" $ do
+            ok <- isValidError $ findCaptureID [cp|foo|] $ reCaptureNames [re|foo|]
+            assertBool "failed" ok
         ]
+    , testGroup "QQ"
+        [ qq_tc "re"                      re
+        , qq_tc "reMS"                    reMS
+        , qq_tc "reMI"                    reMI
+        , qq_tc "reBS"                    reBS
+        , qq_tc "reBI"                    reBI
+        , qq_tc "reMultilineSensitive"    reMultilineSensitive
+        , qq_tc "reMultilineInsensitive"  reMultilineInsensitive
+        , qq_tc "reBlockSensitive"        reBlockSensitive
+        , qq_tc "reBlockInsensitive"      reBlockInsensitive
+        , qq_tc "re_"                     re_
+        , qq_tc "ed"                      ed
+        , qq_tc "edMS"                    edMS
+        , qq_tc "edMI"                    edMI
+        , qq_tc "edBS"                    edBS
+        , qq_tc "edBI"                    edBI
+        , qq_tc "edMultilineSensitive"    edMultilineSensitive
+        , qq_tc "edMultilineInsensitive"  edMultilineInsensitive
+        , qq_tc "edBlockSensitive"        edBlockSensitive
+        , qq_tc "edBlockInsensitive"      edBlockInsensitive
+        , qq_tc "ed_"                     ed_
+        ]
     , testGroup "PreludeMacros"
         [ valid_string "preludeMacroTable"    preludeMacroTable
         , valid_macro  "preludeMacroSummary"  preludeMacroSummary
@@ -595,10 +719,20 @@
             , TDFA.reBlockSensitive
             , TDFA.reBlockInsensitive
             , TDFA.re_
+            , TDFA.ed
+            , TDFA.edMS
+            , TDFA.edMI
+            , TDFA.edBS
+            , TDFA.edBI
+            , TDFA.edMultilineSensitive
+            , TDFA.edMultilineInsensitive
+            , TDFA.edBlockSensitive
+            , TDFA.edBlockInsensitive
+            , TDFA.ed_
             ]
         , testCase  "TDFA.regexType"           $ assertBool "TDFA" $ isTDFA TDFA.regexType
         , testCase  "TDFA.reOptions"           $ assert_empty_macs $ optionsMacs (TDFA.reOptions tdfa_re)
-        , testCase  "TDFA.makeOptions md"      $ assert_empty_macs $ optionsMacs tdfa_opts
+        , testCase  "TDFA.makeREOptions md"      $ assert_empty_macs $ optionsMacs tdfa_opts
         , testCase  "TDFA.preludeTestsFailing" $ []      @=? TDFA.preludeTestsFailing
         , ne_string "TDFA.preludeTable"          TDFA.preludeTable
         , ne_string "TDFA.preludeSources"        TDFA.preludeSources
@@ -623,10 +757,20 @@
             , PCRE.reBlockSensitive
             , PCRE.reBlockInsensitive
             , PCRE.re_
+            , PCRE.ed
+            , PCRE.edMS
+            , PCRE.edMI
+            , PCRE.edBS
+            , PCRE.edBI
+            , PCRE.edMultilineSensitive
+            , PCRE.edMultilineInsensitive
+            , PCRE.edBlockSensitive
+            , PCRE.edBlockInsensitive
+            , PCRE.ed_
             ]
         , testCase  "PCRE.regexType"           $ assertBool "PCRE" $ isPCRE PCRE.regexType
         , testCase  "PCRE.reOptions"           $ assert_empty_macs $ optionsMacs (PCRE.reOptions pcre_re)
-        , testCase  "PCRE.makeOptions md"      $ assert_empty_macs $ optionsMacs pcre_opts
+        , testCase  "PCRE.makeREOptions md"      $ assert_empty_macs $ optionsMacs pcre_opts
         , testCase  "PCRE.preludeTestsFailing" $ []      @=? PCRE.preludeTestsFailing
         , ne_string "PCRE.preludeTable"          PCRE.preludeTable
         , ne_string "PCRE.preludeTable"          PCRE.preludeSources
@@ -644,8 +788,8 @@
     tdfa_re   = fromMaybe oops $ TDFA.compileRegexWithOptions tdfa_opts ".*"
     pcre_re   = fromMaybe oops $ PCRE.compileRegexWithOptions pcre_opts ".*"
 
-    tdfa_opts = makeOptions no_macs_t :: Options_ TDFA.RE TDFA_.CompOption TDFA_.ExecOption
-    pcre_opts = makeOptions no_macs_p :: Options_ PCRE.RE PCRE_.CompOption PCRE_.ExecOption
+    tdfa_opts = makeREOptions no_macs_t :: REOptions_ TDFA.RE TDFA_.CompOption TDFA_.ExecOption
+    pcre_opts = makeREOptions no_macs_p :: REOptions_ PCRE.RE PCRE_.CompOption PCRE_.ExecOption
 
     no_macs_t = HM.fromList [] :: Macros TDFA.RE
     no_macs_p = HM.fromList [] :: Macros PCRE.RE
@@ -654,17 +798,8 @@
 
     assert_empty_macs = assertBool "macros not empty" . HM.null
 
-qq_tc :: String -> (QuasiQuoter->String->a) -> TestTree
-qq_tc sc prj = testCase sc $
-    try tst >>= either hdl (const $ assertFailure "qq0")
-  where
-    tst :: IO ()
-    tst = prj (qq0 "qq_tc") "" `seq` return ()
-
-    hdl :: QQFailure -> IO ()
-    hdl qqf = do
-      "qq_tc" @=? _qqf_context   qqf
-      sc      @=? _qqf_component qqf
+qq_tc :: String -> QuasiQuoter -> TestTree
+qq_tc lab qq = testCase lab $ quoteExp qq `seq` assertBool "qq_tc" True
 
 valid_macro :: String -> (RegexType->PreludeMacro->String) -> TestTree
 valid_macro label f = testGroup label
@@ -696,4 +831,24 @@
 
 s_toList :: S.Seq Char -> [Char]
 s_toList = F.toList
+
+newtype Identity a = Identity { runIdentity :: a }
+  deriving (Functor)
+
+instance Applicative Identity where
+  pure = Identity
+  (<*>) (Identity f) (Identity x) = Identity $ f x
+
+instance Monad Identity where
+  return = Identity
+  (>>=) (Identity x) f = f x
+
+isValidError :: a -> IO Bool
+isValidError x = catch (x `seq` return False) hdl
+  where
+    hdl :: SomeException -> IO Bool
+    hdl se = return $ (length $ show se) `seq` True
+
+un_either :: Either String a -> a
+un_either = either error id
 \end{code}
diff --git a/examples/re-tutorial.lhs b/examples/re-tutorial.lhs
--- a/examples/re-tutorial.lhs
+++ b/examples/re-tutorial.lhs
@@ -93,8 +93,11 @@
 options.
 \begin{code}
 import           Text.RE.TDFA.String
+import           Text.RE.Types.Capture
 import           Text.RE.Types.CaptureID
-import           Text.RE.Types.Options
+import           Text.RE.Types.Match
+import           Text.RE.Types.REOptions
+import           Text.RE.Types.Replace
 \end{code}
 If you are predominantly matching against a single type in your module
 then you will probably find it more convenient to use the relevant module
@@ -311,7 +314,7 @@
 worked-out examples of these `Matches`/`Match`/`Capture` types.
 
 
-Simple Options
+Simple REOptions
 --------------
 
 By default regular expressions are of the multi-line case-sensitive
@@ -363,9 +366,9 @@
 -------------------------------
 
 Sometimes you will need to process each string captured by an RE with a
-function. `replaceAllCaptures` takes a `Context`, a substitution
+function. `replaceAllCaptures` takes a `REContext`, a substitution
 function and a `Matches` and applies the function to each captured
-substring according to the `Context`, as we can see in the following
+substring according to the `REContext`, as we can see in the following
 example function to clean up all of the mis-formatted dates in the
 argument string,
 \begin{code}
@@ -390,13 +393,13 @@
 
 %include "Text/RE/Types/Replace.lhs" "replaceAllCaptures ::"
 
-and the `Context` and `Location` types are defined in
+and the `REContext` and `Location` types are defined in
 `Text.RE.Types.Replace` as follows,
 
-%include "Text/RE/Types/Replace.lhs" "^data Context"
+%include "Text/RE/Types/Replace.lhs" "^data REContext"
 
 The processing function gets applied to the captures specified by the
-`Context`, which can be directed to process `ALL` of the captures,
+`REContext`, which can be directed to process `ALL` of the captures,
 including the substring captured by the whole RE and all of the
 subsidiary capture, or just the `TOP`, `0` capture that the whole RE
 matches, or just the `SUB` (subsidiary) captures, as was the case above.
@@ -457,7 +460,7 @@
 regex test bench.
 
 
-Compiling REs with the Complete Options
+Compiling REs with the Complete REOptions
 ---------------------------------------
 
 Each type of RE &mdash; TDFA and PCRE &mdash; has it own complile-time
@@ -467,20 +470,20 @@
 accordingly so that you don't have to, but you may need full access to
 you chosen back end's options, or you may need to supply a different
 set of macros to those provided in the standard environment. In which
-case you will need to know about the `Options` type, defined by each of
-the back ends in terms of the `Options_` type of `Text.RE.Types.Options`
+case you will need to know about the `REOptions` type, defined by each of
+the back ends in terms of the `REOptions_` type of `Text.RE.Types.REOptions`
 as follows.
 <div class='inlinecodeblock'>
 ```
-type Options = Options_ RE CompOption ExecOption
+type REOptions = REOptions_ RE CompOption ExecOption
 ```
 </div>
 (Bear in mind that `CompOption` and `ExecOption` will be different
 types for each back end.)
 
-The `Options_` type is defined in `Text.RE.Types.Options` as follows:
+The `REOptions_` type is defined in `Text.RE.Types.REOptions` as follows:
 
-%include "Text/RE/Types/Options.lhs" "data Options_"
+%include "Text/RE/Types/REOptions.lhs" "data REOptions_"
 
   * `optionsMode` is an experimental feature that controls the RE
     parser.
@@ -514,10 +517,10 @@
   * `()` (the unit type) means just use the default multi-line
     case-sensitive that we get with the `re` parser.
 
-  * `SimpleRegexOptions` this is just a simple enum type that we use to
+  * `SimpleREOptions` this is just a simple enum type that we use to
     encode the standard options:
 
-%include "Text/RE/Types/Options.lhs" "^data SimpleRegexOptions"
+%include "Text/RE/Types/REOptions.lhs" "^data SimpleREOptions"
 
   * `Mode`: you can specify the parser mode;
 
@@ -530,7 +533,7 @@
   * `ExecOption`: you can specify the execution-time options for the
     back end;
 
-  * `Options`: you can specify all of the options.
+  * `REOptions`: you can specify all of the options.
 
 The compilation may fail so it is expressed monadically. For the
 following examples we will use the following helper to just `error`
@@ -551,7 +554,7 @@
 text to be compiled or the options have been dynamically determined.
 
 
-Specifying Options with `re_`
+Specifying REOptions with `re_`
 -----------------------------
 
 If you just need to specify some non-standard options while statically
@@ -715,12 +718,12 @@
 \begin{code}
 type Template = String
 
-parseTemplateE' :: Template
+parseTemplateR' :: Template
                 -> Match String
                 -> Location
                 -> Capture String
                 -> Maybe String
-parseTemplateE' tpl mtch _ _ =
+parseTemplateR' tpl mtch _ _ =
     Just $ replaceAllCaptures TOP phi $
       tpl *=~ [re|\$${arg}(\$|[0-9]+|\{${name}([^{}]+)\})|]
   where
@@ -737,7 +740,7 @@
         this cid = capturedText <$> mtch !$? cid
 
 my_replace :: RE -> Template-> String -> String
-my_replace rex tpl src = replaceAllCaptures TOP (parseTemplateE' tpl) $ src *=~ rex
+my_replace rex tpl src = replaceAllCaptures TOP (parseTemplateR' tpl) $ src *=~ rex
 \end{code}
 
 It can be tested with our date-reformater example.
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
@@ -6,14 +6,14 @@
     Other-Modules:
       TestKit
 
-%build-depends regex array base base-compat containers bytestring directory regex-base regex-tdfa shelly text
+%build-depends-prog regex array base base-compat containers bytestring directory regex-base regex-tdfa shelly text
 
 %test-exe re-gen-modules
     Hs-Source-Dirs:     examples
 
     Main-Is:            re-gen-modules.lhs
 
-%build-depends regex array base base-compat bytestring directory regex-base regex-tdfa shelly text
+%build-depends-prog regex array base base-compat bytestring directory regex-base regex-tdfa shelly text
 
 %test-exe re-include
     Hs-Source-Dirs:     examples
@@ -23,14 +23,14 @@
     Other-Modules:
       TestKit
 
-%build-depends regex base base-compat bytestring directory shelly text
+%build-depends-prog regex base base-compat bytestring directory shelly text
 
 %test-exe re-nginx-log-processor
     Hs-Source-Dirs:     examples
 
     Main-Is:            re-nginx-log-processor.lhs
 
-%build-depends regex regex-with-pcre array base base-compat bytestring directory regex-base regex-tdfa shelly text time time-locale-compat transformers unordered-containers
+%build-depends-prog regex regex-with-pcre array base base-compat bytestring directory regex-base regex-tdfa shelly text time time-locale-compat transformers unordered-containers
 
 %test-exe re-prep
     Hs-Source-Dirs:     examples
@@ -40,7 +40,7 @@
     Other-Modules:
       TestKit
 
-%build-depends regex base base-compat bytestring directory heredoc http-conduit shelly text
+%build-depends-prog regex base base-compat bytestring directory heredoc http-conduit shelly text
 
 %test-exe re-tests
     Hs-Source-Dirs:     examples
@@ -50,7 +50,7 @@
     Other-Modules:
       TestKit
 
-%build-depends regex regex-with-pcre array base base-compat bytestring containers directory heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin smallcheck tasty tasty-hunit tasty-smallcheck template-haskell text unordered-containers
+%build-depends-prog regex regex-with-pcre array base base-compat bytestring containers directory heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin smallcheck tasty tasty-hunit tasty-smallcheck template-haskell text unordered-containers
 
 %test-exe re-tutorial
     Hs-Source-Dirs:     examples
@@ -61,7 +61,7 @@
       TestKit
 
     Default-Extensions: QuasiQuotes
-%build-depends 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
+%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 re-tutorial-os
     Hs-Source-Dirs:     examples
@@ -73,4 +73,4 @@
 
     Extensions:         OverloadedStrings
     Default-Extensions: QuasiQuotes
-%build-depends 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
+%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
@@ -1,3 +1,7 @@
+
+
+
+
 Library
     Hs-Source-Dirs:     .
     Exposed-Modules:
@@ -13,6 +17,8 @@
       Text.RE.PCRE.RE
       Text.RE.PCRE.Sequence
       Text.RE.PCRE.String
+      Text.RE.SearchReplace
+      Text.RE.Summa
       Text.RE.TDFA
       Text.RE.TDFA.ByteString
       Text.RE.TDFA.ByteString.Lazy
@@ -28,13 +34,15 @@
       Text.RE.Tools.Grep
       Text.RE.Tools.Lex
       Text.RE.Tools.Sed
+      Text.RE.Types
       Text.RE.Types.Capture
       Text.RE.Types.CaptureID
       Text.RE.Types.IsRegex
       Text.RE.Types.LineNo
       Text.RE.Types.Match
       Text.RE.Types.Matches
-      Text.RE.Types.Options
+      Text.RE.Types.REOptions
       Text.RE.Types.Replace
+      Text.RE.Types.SearchReplace
 
-%build-depends array bytestring base base-compat containers hashable heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin template-haskell text time time-locale-compat transformers unordered-containers
+%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/mega-regex.cabal b/lib/cabal-masters/mega-regex.cabal
--- a/lib/cabal-masters/mega-regex.cabal
+++ b/lib/cabal-masters/mega-regex.cabal
@@ -20,7 +20,7 @@
 
 %include "lib/cabal-masters/test-extra-source-files-incl.cabal"
 
-Cabal-Version:          >= 1.16
+Cabal-Version:          >= 1.10
 
 Source-Repository head
     type:               git
diff --git a/lib/cabal-masters/regex-examples.cabal b/lib/cabal-masters/regex-examples.cabal
--- a/lib/cabal-masters/regex-examples.cabal
+++ b/lib/cabal-masters/regex-examples.cabal
@@ -21,7 +21,7 @@
 
 %include "lib/cabal-masters/test-extra-source-files-incl.cabal"
 
-Cabal-Version:          >= 1.16
+Cabal-Version:          >= 1.10
 
 Source-Repository head
     type:               git
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
@@ -11,6 +11,8 @@
       Text.RE.Internal.NamedCaptures
       Text.RE.Internal.PreludeMacros
       Text.RE.Internal.QQ
+      Text.RE.SearchReplace
+      Text.RE.Summa
       Text.RE.TDFA
       Text.RE.TDFA.ByteString
       Text.RE.TDFA.ByteString.Lazy
@@ -26,15 +28,17 @@
       Text.RE.Tools.Grep
       Text.RE.Tools.Lex
       Text.RE.Tools.Sed
+      Text.RE.Types
       Text.RE.Types.Capture
       Text.RE.Types.CaptureID
       Text.RE.Types.IsRegex
       Text.RE.Types.LineNo
       Text.RE.Types.Match
       Text.RE.Types.Matches
-      Text.RE.Types.Options
+      Text.RE.Types.REOptions
       Text.RE.Types.Replace
+      Text.RE.Types.SearchReplace
 
-%build-depends array bytestring base base-compat containers hashable heredoc regex-base regex-tdfa regex-tdfa-text template-haskell text time time-locale-compat transformers unordered-containers
+%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
 
 -- 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.8.0.0
+Version:                0.9.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
@@ -53,7 +53,7 @@
     src/Text/RE/TDFA/Text/Lazy.hs
 
 
-Cabal-Version:          >= 1.16
+Cabal-Version:          >= 1.10
 
 Source-Repository head
     type:               git
@@ -62,10 +62,14 @@
 Source-Repository this
     Type:               git
     Location:           https://github.com/iconnect/regex.git
-    Tag:                0.8.0.0
+    Tag:                0.9.0.0
 
 
 
+
+
+
+
 Library
     Hs-Source-Dirs:     .
     Exposed-Modules:
@@ -81,6 +85,8 @@
       Text.RE.PCRE.RE
       Text.RE.PCRE.Sequence
       Text.RE.PCRE.String
+      Text.RE.SearchReplace
+      Text.RE.Summa
       Text.RE.TDFA
       Text.RE.TDFA.ByteString
       Text.RE.TDFA.ByteString.Lazy
@@ -96,16 +102,44 @@
       Text.RE.Tools.Grep
       Text.RE.Tools.Lex
       Text.RE.Tools.Sed
+      Text.RE.Types
       Text.RE.Types.Capture
       Text.RE.Types.CaptureID
       Text.RE.Types.IsRegex
       Text.RE.Types.LineNo
       Text.RE.Types.Match
       Text.RE.Types.Matches
-      Text.RE.Types.Options
+      Text.RE.Types.REOptions
       Text.RE.Types.Replace
+      Text.RE.Types.SearchReplace
 
     Default-Language:   Haskell2010
+
+    Other-Extensions:
+      AllowAmbiguousTypes
+      CPP
+      DeriveDataTypeable
+      DeriveGeneric
+      ExistentialQuantification
+      FlexibleContexts
+      FlexibleInstances
+      FunctionalDependencies
+      GeneralizedNewtypeDeriving
+      MultiParamTypeClasses
+      NoImplicitPrelude
+      OverloadedStrings
+      QuasiQuotes
+      RecordWildCards
+      ScopedTypeVariables
+      TemplateHaskell
+      TypeSynonymInstances
+      UndecidableInstances
+
+    if !impl(ghc >= 8.0)
+      Other-Extensions: TemplateHaskell
+    else
+      Other-Extensions: TemplateHaskellQuotes
+
     GHC-Options:
       -Wall
       -fwarn-tabs
@@ -118,7 +152,6 @@
       , bytestring           >= 0.10.2.0
       , containers           >= 0.4
       , 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
@@ -141,13 +174,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -170,13 +204,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -196,13 +231,14 @@
     Main-Is:            re-gen-modules.lhs
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -221,13 +257,14 @@
     Main-Is:            re-gen-modules.lhs
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -249,13 +286,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
@@ -274,13 +312,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
@@ -296,13 +335,14 @@
     Main-Is:            re-nginx-log-processor.lhs
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -325,13 +365,14 @@
     Main-Is:            re-nginx-log-processor.lhs
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -357,13 +398,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
@@ -384,13 +426,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
@@ -411,13 +454,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -448,13 +492,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -486,13 +531,14 @@
 
     Default-Extensions: QuasiQuotes
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -529,13 +575,14 @@
 
     Default-Extensions: QuasiQuotes
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -574,13 +621,14 @@
     Extensions:         OverloadedStrings
     Default-Extensions: QuasiQuotes
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Werror
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.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.8.0.0
+0.9.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.8.0.0
+Version:                0.9.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
@@ -54,7 +54,7 @@
     src/Text/RE/TDFA/Text/Lazy.hs
 
 
-Cabal-Version:          >= 1.16
+Cabal-Version:          >= 1.10
 
 Source-Repository head
     type:               git
@@ -63,7 +63,7 @@
 Source-Repository this
     Type:               git
     Location:           https://github.com/iconnect/regex.git
-    Tag:                0.8.0.0
+    Tag:                0.9.0.0
 
 
 
@@ -76,13 +76,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -105,13 +106,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -131,13 +133,14 @@
     Main-Is:            re-gen-modules.lhs
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -156,13 +159,14 @@
     Main-Is:            re-gen-modules.lhs
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -184,13 +188,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
@@ -209,13 +214,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
@@ -231,14 +237,15 @@
     Main-Is:            re-nginx-log-processor.lhs
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
-      , regex-with-pcre      == 0.8.0.0
+        regex                == 0.9.0.0
+      , regex-with-pcre      == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -261,14 +268,15 @@
     Main-Is:            re-nginx-log-processor.lhs
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
-      , regex-with-pcre      == 0.8.0.0
+        regex                == 0.9.0.0
+      , regex-with-pcre      == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -294,13 +302,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
@@ -321,13 +330,14 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
       , bytestring           >= 0.10.2.0
@@ -348,14 +358,15 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
-      , regex-with-pcre      == 0.8.0.0
+        regex                == 0.9.0.0
+      , regex-with-pcre      == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -386,14 +397,15 @@
       TestKit
 
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
-      , regex-with-pcre      == 0.8.0.0
+        regex                == 0.9.0.0
+      , regex-with-pcre      == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -425,13 +437,14 @@
 
     Default-Extensions: QuasiQuotes
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -468,13 +481,14 @@
 
     Default-Extensions: QuasiQuotes
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.0.0
       , array                >= 0.4
       , base                 >= 4 && < 5
       , base-compat          >= 0.6.0
@@ -513,13 +527,14 @@
     Extensions:         OverloadedStrings
     Default-Extensions: QuasiQuotes
     Default-Language:   Haskell2010
+
     GHC-Options:
       -Wall
       -fwarn-tabs
       -Wwarn
 
     Build-depends:
-        regex                == 0.8.0.0
+        regex                == 0.9.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
@@ -13,22 +13,36 @@
   (
   -- * Tutorial
   -- $tutorial
-
+  --
   -- * The Match Operators
     (*=~)
   , (?=~)
+  -- * The SearchReplace Operators
+  , (*=~/)
+  , (?=~/)
+  -- * The Classic rexex-base Match Operators
   , (=~)
   , (=~~)
-  -- * The Toolkit
-  -- $toolkit
-  , module Text.RE
-  -- * The 'RE' Type and functions
-  -- $re
+  -- * Matches
+  , Matches
+  , matchesSource
+  , allMatches
+  , anyMatches
+  , countMatches
+  , matches
+  -- * Match
+  , Match
+  , matchSource
+  , matched
+  , matchedText
+  -- * The 'RE' Type and Functions
   , RE
+  , SimpleREOptions(..)
   , reSource
   , compileRegex
   , compileRegexWith
   , escape
+  , escapeWith
   , module Text.RE.PCRE.RE
   ) where
 
@@ -37,8 +51,11 @@
 import           Data.Typeable
 import           Text.Regex.Base
 import           Text.RE
-import           Text.RE.Types.IsRegex
 import           Text.RE.Internal.AddCaptureNames
+import           Text.RE.SearchReplace
+import           Text.RE.Types.IsRegex
+import           Text.RE.Types.REOptions
+import           Text.RE.Types.Replace
 import           Text.RE.PCRE.RE
 import qualified Text.Regex.PCRE               as PCRE
 
@@ -55,6 +72,14 @@
       -> Match B.ByteString
 (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs
 
+-- | search and replace once
+(?=~/) :: B.ByteString -> SearchReplace RE B.ByteString -> B.ByteString
+(?=~/) = flip searchReplaceFirst
+
+-- | search and replace, all occurrences
+(*=~/) :: B.ByteString -> SearchReplace RE B.ByteString -> B.ByteString
+(*=~/) = flip searchReplaceAll
+
 -- | the regex-base polymorphic match operator
 (=~) :: ( Typeable a
         , RegexContext PCRE.Regex B.ByteString a
@@ -78,23 +103,11 @@
 (=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs
 
 instance IsRegex RE B.ByteString where
-  matchOnce     = flip (?=~)
-  matchMany     = flip (*=~)
-  makeRegexWith = \o -> compileRegexWith o . unpackE
-  makeRegex     = compileRegex . unpackE
-  regexSource   = packE . reSource
+  matchOnce             = flip (?=~)
+  matchMany             = flip (*=~)
+  makeRegexWith         = \o -> compileRegexWith o . unpackR
+  makeSearchReplaceWith = \o r t -> compileSearchReplaceWith o (unpackR r) (unpackR t)
+  regexSource           = packR . reSource
 
 -- $tutorial
--- We have a regex tutorial at <http://tutorial.regex.uk>. These API
--- docs are mainly for reference.
-
--- $toolkit
---
--- Beyond the above match operators and the regular expression type
--- below, "Text.RE" contains the toolkit for replacing captures,
--- specifying options, etc.
-
--- $re
---
--- "Text.RE.PCRE.RE" contains the toolkit specific to the 'RE' type,
--- the type generated by the gegex compiler.
+-- We have a regex tutorial at <http://tutorial.regex.uk>.
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
@@ -13,22 +13,36 @@
   (
   -- * Tutorial
   -- $tutorial
-
+  --
   -- * The Match Operators
     (*=~)
   , (?=~)
+  -- * The SearchReplace Operators
+  , (*=~/)
+  , (?=~/)
+  -- * The Classic rexex-base Match Operators
   , (=~)
   , (=~~)
-  -- * The Toolkit
-  -- $toolkit
-  , module Text.RE
-  -- * The 'RE' Type and functions
-  -- $re
+  -- * Matches
+  , Matches
+  , matchesSource
+  , allMatches
+  , anyMatches
+  , countMatches
+  , matches
+  -- * Match
+  , Match
+  , matchSource
+  , matched
+  , matchedText
+  -- * The 'RE' Type and Functions
   , RE
+  , SimpleREOptions(..)
   , reSource
   , compileRegex
   , compileRegexWith
   , escape
+  , escapeWith
   , module Text.RE.PCRE.RE
   ) where
 
@@ -37,8 +51,11 @@
 import           Data.Typeable
 import           Text.Regex.Base
 import           Text.RE
-import           Text.RE.Types.IsRegex
 import           Text.RE.Internal.AddCaptureNames
+import           Text.RE.SearchReplace
+import           Text.RE.Types.IsRegex
+import           Text.RE.Types.REOptions
+import           Text.RE.Types.Replace
 import           Text.RE.PCRE.RE
 import qualified Text.Regex.PCRE               as PCRE
 
@@ -55,6 +72,14 @@
       -> Match LBS.ByteString
 (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs
 
+-- | search and replace once
+(?=~/) :: LBS.ByteString -> SearchReplace RE LBS.ByteString -> LBS.ByteString
+(?=~/) = flip searchReplaceFirst
+
+-- | search and replace, all occurrences
+(*=~/) :: LBS.ByteString -> SearchReplace RE LBS.ByteString -> LBS.ByteString
+(*=~/) = flip searchReplaceAll
+
 -- | the regex-base polymorphic match operator
 (=~) :: ( Typeable a
         , RegexContext PCRE.Regex LBS.ByteString a
@@ -78,23 +103,11 @@
 (=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs
 
 instance IsRegex RE LBS.ByteString where
-  matchOnce     = flip (?=~)
-  matchMany     = flip (*=~)
-  makeRegexWith = \o -> compileRegexWith o . unpackE
-  makeRegex     = compileRegex . unpackE
-  regexSource   = packE . reSource
+  matchOnce             = flip (?=~)
+  matchMany             = flip (*=~)
+  makeRegexWith         = \o -> compileRegexWith o . unpackR
+  makeSearchReplaceWith = \o r t -> compileSearchReplaceWith o (unpackR r) (unpackR t)
+  regexSource           = packR . reSource
 
 -- $tutorial
--- We have a regex tutorial at <http://tutorial.regex.uk>. These API
--- docs are mainly for reference.
-
--- $toolkit
---
--- Beyond the above match operators and the regular expression type
--- below, "Text.RE" contains the toolkit for replacing captures,
--- specifying options, etc.
-
--- $re
---
--- "Text.RE.PCRE.RE" contains the toolkit specific to the 'RE' type,
--- the type generated by the gegex compiler.
+-- We have a regex tutorial at <http://tutorial.regex.uk>.
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
@@ -13,22 +13,36 @@
   (
   -- * Tutorial
   -- $tutorial
-
+  --
   -- * The Match Operators
     (*=~)
   , (?=~)
+  -- * The SearchReplace Operators
+  , (*=~/)
+  , (?=~/)
+  -- * The Classic rexex-base Match Operators
   , (=~)
   , (=~~)
-  -- * The Toolkit
-  -- $toolkit
-  , module Text.RE
-  -- * The 'RE' Type and functions
-  -- $re
+  -- * Matches
+  , Matches
+  , matchesSource
+  , allMatches
+  , anyMatches
+  , countMatches
+  , matches
+  -- * Match
+  , Match
+  , matchSource
+  , matched
+  , matchedText
+  -- * The 'RE' Type and Functions
   , RE
+  , SimpleREOptions(..)
   , reSource
   , compileRegex
   , compileRegexWith
   , escape
+  , escapeWith
   , module Text.RE.PCRE.RE
   ) where
 
@@ -37,8 +51,11 @@
 import           Data.Typeable
 import           Text.Regex.Base
 import           Text.RE
-import           Text.RE.Types.IsRegex
 import           Text.RE.Internal.AddCaptureNames
+import           Text.RE.SearchReplace
+import           Text.RE.Types.IsRegex
+import           Text.RE.Types.REOptions
+import           Text.RE.Types.Replace
 import           Text.RE.PCRE.RE
 import qualified Text.Regex.PCRE               as PCRE
 
@@ -55,6 +72,14 @@
       -> Match (S.Seq Char)
 (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs
 
+-- | search and replace once
+(?=~/) :: (S.Seq Char) -> SearchReplace RE (S.Seq Char) -> (S.Seq Char)
+(?=~/) = flip searchReplaceFirst
+
+-- | search and replace, all occurrences
+(*=~/) :: (S.Seq Char) -> SearchReplace RE (S.Seq Char) -> (S.Seq Char)
+(*=~/) = flip searchReplaceAll
+
 -- | the regex-base polymorphic match operator
 (=~) :: ( Typeable a
         , RegexContext PCRE.Regex (S.Seq Char) a
@@ -78,23 +103,11 @@
 (=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs
 
 instance IsRegex RE (S.Seq Char) where
-  matchOnce     = flip (?=~)
-  matchMany     = flip (*=~)
-  makeRegexWith = \o -> compileRegexWith o . unpackE
-  makeRegex     = compileRegex . unpackE
-  regexSource   = packE . reSource
+  matchOnce             = flip (?=~)
+  matchMany             = flip (*=~)
+  makeRegexWith         = \o -> compileRegexWith o . unpackR
+  makeSearchReplaceWith = \o r t -> compileSearchReplaceWith o (unpackR r) (unpackR t)
+  regexSource           = packR . reSource
 
 -- $tutorial
--- We have a regex tutorial at <http://tutorial.regex.uk>. These API
--- docs are mainly for reference.
-
--- $toolkit
---
--- Beyond the above match operators and the regular expression type
--- below, "Text.RE" contains the toolkit for replacing captures,
--- specifying options, etc.
-
--- $re
---
--- "Text.RE.PCRE.RE" contains the toolkit specific to the 'RE' type,
--- the type generated by the gegex compiler.
+-- We have a regex tutorial at <http://tutorial.regex.uk>.
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
@@ -13,22 +13,36 @@
   (
   -- * Tutorial
   -- $tutorial
-
+  --
   -- * The Match Operators
     (*=~)
   , (?=~)
+  -- * The SearchReplace Operators
+  , (*=~/)
+  , (?=~/)
+  -- * The Classic rexex-base Match Operators
   , (=~)
   , (=~~)
-  -- * The Toolkit
-  -- $toolkit
-  , module Text.RE
-  -- * The 'RE' Type and functions
-  -- $re
+  -- * Matches
+  , Matches
+  , matchesSource
+  , allMatches
+  , anyMatches
+  , countMatches
+  , matches
+  -- * Match
+  , Match
+  , matchSource
+  , matched
+  , matchedText
+  -- * The 'RE' Type and Functions
   , RE
+  , SimpleREOptions(..)
   , reSource
   , compileRegex
   , compileRegexWith
   , escape
+  , escapeWith
   , module Text.RE.PCRE.RE
   ) where
 
@@ -37,8 +51,11 @@
 import           Data.Typeable
 import           Text.Regex.Base
 import           Text.RE
-import           Text.RE.Types.IsRegex
 import           Text.RE.Internal.AddCaptureNames
+import           Text.RE.SearchReplace
+import           Text.RE.Types.IsRegex
+import           Text.RE.Types.REOptions
+import           Text.RE.Types.Replace
 import           Text.RE.PCRE.RE
 import qualified Text.Regex.PCRE               as PCRE
 
@@ -55,6 +72,14 @@
       -> Match String
 (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs
 
+-- | search and replace once
+(?=~/) :: String -> SearchReplace RE String -> String
+(?=~/) = flip searchReplaceFirst
+
+-- | search and replace, all occurrences
+(*=~/) :: String -> SearchReplace RE String -> String
+(*=~/) = flip searchReplaceAll
+
 -- | the regex-base polymorphic match operator
 (=~) :: ( Typeable a
         , RegexContext PCRE.Regex String a
@@ -78,23 +103,11 @@
 (=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs
 
 instance IsRegex RE String where
-  matchOnce     = flip (?=~)
-  matchMany     = flip (*=~)
-  makeRegexWith = \o -> compileRegexWith o . unpackE
-  makeRegex     = compileRegex . unpackE
-  regexSource   = packE . reSource
+  matchOnce             = flip (?=~)
+  matchMany             = flip (*=~)
+  makeRegexWith         = \o -> compileRegexWith o . unpackR
+  makeSearchReplaceWith = \o r t -> compileSearchReplaceWith o (unpackR r) (unpackR t)
+  regexSource           = packR . reSource
 
 -- $tutorial
--- We have a regex tutorial at <http://tutorial.regex.uk>. These API
--- docs are mainly for reference.
-
--- $toolkit
---
--- Beyond the above match operators and the regular expression type
--- below, "Text.RE" contains the toolkit for replacing captures,
--- specifying options, etc.
-
--- $re
---
--- "Text.RE.PCRE.RE" contains the toolkit specific to the 'RE' type,
--- the type generated by the gegex compiler.
+-- We have a regex tutorial at <http://tutorial.regex.uk>.
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
@@ -13,22 +13,36 @@
   (
   -- * Tutorial
   -- $tutorial
-
+  --
   -- * The Match Operators
     (*=~)
   , (?=~)
+  -- * The SearchReplace Operators
+  , (*=~/)
+  , (?=~/)
+  -- * The Classic rexex-base Match Operators
   , (=~)
   , (=~~)
-  -- * The Toolkit
-  -- $toolkit
-  , module Text.RE
-  -- * The 'RE' Type and functions
-  -- $re
+  -- * Matches
+  , Matches
+  , matchesSource
+  , allMatches
+  , anyMatches
+  , countMatches
+  , matches
+  -- * Match
+  , Match
+  , matchSource
+  , matched
+  , matchedText
+  -- * The 'RE' Type and Functions
   , RE
+  , SimpleREOptions(..)
   , reSource
   , compileRegex
   , compileRegexWith
   , escape
+  , escapeWith
   , module Text.RE.TDFA.RE
   ) where
 
@@ -37,8 +51,11 @@
 import           Data.Typeable
 import           Text.Regex.Base
 import           Text.RE
-import           Text.RE.Types.IsRegex
 import           Text.RE.Internal.AddCaptureNames
+import           Text.RE.SearchReplace
+import           Text.RE.Types.IsRegex
+import           Text.RE.Types.REOptions
+import           Text.RE.Types.Replace
 import           Text.RE.TDFA.RE
 import qualified Text.Regex.TDFA               as TDFA
 
@@ -55,6 +72,14 @@
       -> Match B.ByteString
 (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs
 
+-- | search and replace once
+(?=~/) :: B.ByteString -> SearchReplace RE B.ByteString -> B.ByteString
+(?=~/) = flip searchReplaceFirst
+
+-- | search and replace, all occurrences
+(*=~/) :: B.ByteString -> SearchReplace RE B.ByteString -> B.ByteString
+(*=~/) = flip searchReplaceAll
+
 -- | the regex-base polymorphic match operator
 (=~) :: ( Typeable a
         , RegexContext TDFA.Regex B.ByteString a
@@ -78,23 +103,11 @@
 (=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs
 
 instance IsRegex RE B.ByteString where
-  matchOnce     = flip (?=~)
-  matchMany     = flip (*=~)
-  makeRegexWith = \o -> compileRegexWith o . unpackE
-  makeRegex     = compileRegex . unpackE
-  regexSource   = packE . reSource
+  matchOnce             = flip (?=~)
+  matchMany             = flip (*=~)
+  makeRegexWith         = \o -> compileRegexWith o . unpackR
+  makeSearchReplaceWith = \o r t -> compileSearchReplaceWith o (unpackR r) (unpackR t)
+  regexSource           = packR . reSource
 
 -- $tutorial
--- We have a regex tutorial at <http://tutorial.regex.uk>. These API
--- docs are mainly for reference.
-
--- $toolkit
---
--- Beyond the above match operators and the regular expression type
--- below, "Text.RE" contains the toolkit for replacing captures,
--- specifying options, etc.
-
--- $re
---
--- "Text.RE.TDFA.RE" contains the toolkit specific to the 'RE' type,
--- the type generated by the gegex compiler.
+-- We have a regex tutorial at <http://tutorial.regex.uk>.
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
@@ -13,22 +13,36 @@
   (
   -- * Tutorial
   -- $tutorial
-
+  --
   -- * The Match Operators
     (*=~)
   , (?=~)
+  -- * The SearchReplace Operators
+  , (*=~/)
+  , (?=~/)
+  -- * The Classic rexex-base Match Operators
   , (=~)
   , (=~~)
-  -- * The Toolkit
-  -- $toolkit
-  , module Text.RE
-  -- * The 'RE' Type and functions
-  -- $re
+  -- * Matches
+  , Matches
+  , matchesSource
+  , allMatches
+  , anyMatches
+  , countMatches
+  , matches
+  -- * Match
+  , Match
+  , matchSource
+  , matched
+  , matchedText
+  -- * The 'RE' Type and Functions
   , RE
+  , SimpleREOptions(..)
   , reSource
   , compileRegex
   , compileRegexWith
   , escape
+  , escapeWith
   , module Text.RE.TDFA.RE
   ) where
 
@@ -37,8 +51,11 @@
 import           Data.Typeable
 import           Text.Regex.Base
 import           Text.RE
-import           Text.RE.Types.IsRegex
 import           Text.RE.Internal.AddCaptureNames
+import           Text.RE.SearchReplace
+import           Text.RE.Types.IsRegex
+import           Text.RE.Types.REOptions
+import           Text.RE.Types.Replace
 import           Text.RE.TDFA.RE
 import qualified Text.Regex.TDFA               as TDFA
 
@@ -55,6 +72,14 @@
       -> Match LBS.ByteString
 (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs
 
+-- | search and replace once
+(?=~/) :: LBS.ByteString -> SearchReplace RE LBS.ByteString -> LBS.ByteString
+(?=~/) = flip searchReplaceFirst
+
+-- | search and replace, all occurrences
+(*=~/) :: LBS.ByteString -> SearchReplace RE LBS.ByteString -> LBS.ByteString
+(*=~/) = flip searchReplaceAll
+
 -- | the regex-base polymorphic match operator
 (=~) :: ( Typeable a
         , RegexContext TDFA.Regex LBS.ByteString a
@@ -78,23 +103,11 @@
 (=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs
 
 instance IsRegex RE LBS.ByteString where
-  matchOnce     = flip (?=~)
-  matchMany     = flip (*=~)
-  makeRegexWith = \o -> compileRegexWith o . unpackE
-  makeRegex     = compileRegex . unpackE
-  regexSource   = packE . reSource
+  matchOnce             = flip (?=~)
+  matchMany             = flip (*=~)
+  makeRegexWith         = \o -> compileRegexWith o . unpackR
+  makeSearchReplaceWith = \o r t -> compileSearchReplaceWith o (unpackR r) (unpackR t)
+  regexSource           = packR . reSource
 
 -- $tutorial
--- We have a regex tutorial at <http://tutorial.regex.uk>. These API
--- docs are mainly for reference.
-
--- $toolkit
---
--- Beyond the above match operators and the regular expression type
--- below, "Text.RE" contains the toolkit for replacing captures,
--- specifying options, etc.
-
--- $re
---
--- "Text.RE.TDFA.RE" contains the toolkit specific to the 'RE' type,
--- the type generated by the gegex compiler.
+-- We have a regex tutorial at <http://tutorial.regex.uk>.
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
@@ -13,22 +13,36 @@
   (
   -- * Tutorial
   -- $tutorial
-
+  --
   -- * The Match Operators
     (*=~)
   , (?=~)
+  -- * The SearchReplace Operators
+  , (*=~/)
+  , (?=~/)
+  -- * The Classic rexex-base Match Operators
   , (=~)
   , (=~~)
-  -- * The Toolkit
-  -- $toolkit
-  , module Text.RE
-  -- * The 'RE' Type and functions
-  -- $re
+  -- * Matches
+  , Matches
+  , matchesSource
+  , allMatches
+  , anyMatches
+  , countMatches
+  , matches
+  -- * Match
+  , Match
+  , matchSource
+  , matched
+  , matchedText
+  -- * The 'RE' Type and Functions
   , RE
+  , SimpleREOptions(..)
   , reSource
   , compileRegex
   , compileRegexWith
   , escape
+  , escapeWith
   , module Text.RE.TDFA.RE
   ) where
 
@@ -37,8 +51,11 @@
 import           Data.Typeable
 import           Text.Regex.Base
 import           Text.RE
-import           Text.RE.Types.IsRegex
 import           Text.RE.Internal.AddCaptureNames
+import           Text.RE.SearchReplace
+import           Text.RE.Types.IsRegex
+import           Text.RE.Types.REOptions
+import           Text.RE.Types.Replace
 import           Text.RE.TDFA.RE
 import qualified Text.Regex.TDFA               as TDFA
 
@@ -55,6 +72,14 @@
       -> Match (S.Seq Char)
 (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs
 
+-- | search and replace once
+(?=~/) :: (S.Seq Char) -> SearchReplace RE (S.Seq Char) -> (S.Seq Char)
+(?=~/) = flip searchReplaceFirst
+
+-- | search and replace, all occurrences
+(*=~/) :: (S.Seq Char) -> SearchReplace RE (S.Seq Char) -> (S.Seq Char)
+(*=~/) = flip searchReplaceAll
+
 -- | the regex-base polymorphic match operator
 (=~) :: ( Typeable a
         , RegexContext TDFA.Regex (S.Seq Char) a
@@ -78,23 +103,11 @@
 (=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs
 
 instance IsRegex RE (S.Seq Char) where
-  matchOnce     = flip (?=~)
-  matchMany     = flip (*=~)
-  makeRegexWith = \o -> compileRegexWith o . unpackE
-  makeRegex     = compileRegex . unpackE
-  regexSource   = packE . reSource
+  matchOnce             = flip (?=~)
+  matchMany             = flip (*=~)
+  makeRegexWith         = \o -> compileRegexWith o . unpackR
+  makeSearchReplaceWith = \o r t -> compileSearchReplaceWith o (unpackR r) (unpackR t)
+  regexSource           = packR . reSource
 
 -- $tutorial
--- We have a regex tutorial at <http://tutorial.regex.uk>. These API
--- docs are mainly for reference.
-
--- $toolkit
---
--- Beyond the above match operators and the regular expression type
--- below, "Text.RE" contains the toolkit for replacing captures,
--- specifying options, etc.
-
--- $re
---
--- "Text.RE.TDFA.RE" contains the toolkit specific to the 'RE' type,
--- the type generated by the gegex compiler.
+-- We have a regex tutorial at <http://tutorial.regex.uk>.
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
@@ -13,22 +13,36 @@
   (
   -- * Tutorial
   -- $tutorial
-
+  --
   -- * The Match Operators
     (*=~)
   , (?=~)
+  -- * The SearchReplace Operators
+  , (*=~/)
+  , (?=~/)
+  -- * The Classic rexex-base Match Operators
   , (=~)
   , (=~~)
-  -- * The Toolkit
-  -- $toolkit
-  , module Text.RE
-  -- * The 'RE' Type and functions
-  -- $re
+  -- * Matches
+  , Matches
+  , matchesSource
+  , allMatches
+  , anyMatches
+  , countMatches
+  , matches
+  -- * Match
+  , Match
+  , matchSource
+  , matched
+  , matchedText
+  -- * The 'RE' Type and Functions
   , RE
+  , SimpleREOptions(..)
   , reSource
   , compileRegex
   , compileRegexWith
   , escape
+  , escapeWith
   , module Text.RE.TDFA.RE
   ) where
 
@@ -37,8 +51,11 @@
 import           Data.Typeable
 import           Text.Regex.Base
 import           Text.RE
-import           Text.RE.Types.IsRegex
 import           Text.RE.Internal.AddCaptureNames
+import           Text.RE.SearchReplace
+import           Text.RE.Types.IsRegex
+import           Text.RE.Types.REOptions
+import           Text.RE.Types.Replace
 import           Text.RE.TDFA.RE
 import qualified Text.Regex.TDFA               as TDFA
 
@@ -55,6 +72,14 @@
       -> Match String
 (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs
 
+-- | search and replace once
+(?=~/) :: String -> SearchReplace RE String -> String
+(?=~/) = flip searchReplaceFirst
+
+-- | search and replace, all occurrences
+(*=~/) :: String -> SearchReplace RE String -> String
+(*=~/) = flip searchReplaceAll
+
 -- | the regex-base polymorphic match operator
 (=~) :: ( Typeable a
         , RegexContext TDFA.Regex String a
@@ -78,23 +103,11 @@
 (=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs
 
 instance IsRegex RE String where
-  matchOnce     = flip (?=~)
-  matchMany     = flip (*=~)
-  makeRegexWith = \o -> compileRegexWith o . unpackE
-  makeRegex     = compileRegex . unpackE
-  regexSource   = packE . reSource
+  matchOnce             = flip (?=~)
+  matchMany             = flip (*=~)
+  makeRegexWith         = \o -> compileRegexWith o . unpackR
+  makeSearchReplaceWith = \o r t -> compileSearchReplaceWith o (unpackR r) (unpackR t)
+  regexSource           = packR . reSource
 
 -- $tutorial
--- We have a regex tutorial at <http://tutorial.regex.uk>. These API
--- docs are mainly for reference.
-
--- $toolkit
---
--- Beyond the above match operators and the regular expression type
--- below, "Text.RE" contains the toolkit for replacing captures,
--- specifying options, etc.
-
--- $re
---
--- "Text.RE.TDFA.RE" contains the toolkit specific to the 'RE' type,
--- the type generated by the gegex compiler.
+-- We have a regex tutorial at <http://tutorial.regex.uk>.
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
@@ -13,22 +13,36 @@
   (
   -- * Tutorial
   -- $tutorial
-
+  --
   -- * The Match Operators
     (*=~)
   , (?=~)
+  -- * The SearchReplace Operators
+  , (*=~/)
+  , (?=~/)
+  -- * The Classic rexex-base Match Operators
   , (=~)
   , (=~~)
-  -- * The Toolkit
-  -- $toolkit
-  , module Text.RE
-  -- * The 'RE' Type and functions
-  -- $re
+  -- * Matches
+  , Matches
+  , matchesSource
+  , allMatches
+  , anyMatches
+  , countMatches
+  , matches
+  -- * Match
+  , Match
+  , matchSource
+  , matched
+  , matchedText
+  -- * The 'RE' Type and Functions
   , RE
+  , SimpleREOptions(..)
   , reSource
   , compileRegex
   , compileRegexWith
   , escape
+  , escapeWith
   , module Text.RE.TDFA.RE
   ) where
 
@@ -37,8 +51,11 @@
 import           Data.Typeable
 import           Text.Regex.Base
 import           Text.RE
-import           Text.RE.Types.IsRegex
 import           Text.RE.Internal.AddCaptureNames
+import           Text.RE.SearchReplace
+import           Text.RE.Types.IsRegex
+import           Text.RE.Types.REOptions
+import           Text.RE.Types.Replace
 import           Text.RE.TDFA.RE
 import qualified Text.Regex.TDFA               as TDFA
 
@@ -55,6 +72,14 @@
       -> Match T.Text
 (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs
 
+-- | search and replace once
+(?=~/) :: T.Text -> SearchReplace RE T.Text -> T.Text
+(?=~/) = flip searchReplaceFirst
+
+-- | search and replace, all occurrences
+(*=~/) :: T.Text -> SearchReplace RE T.Text -> T.Text
+(*=~/) = flip searchReplaceAll
+
 -- | the regex-base polymorphic match operator
 (=~) :: ( Typeable a
         , RegexContext TDFA.Regex T.Text a
@@ -78,23 +103,11 @@
 (=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs
 
 instance IsRegex RE T.Text where
-  matchOnce     = flip (?=~)
-  matchMany     = flip (*=~)
-  makeRegexWith = \o -> compileRegexWith o . unpackE
-  makeRegex     = compileRegex . unpackE
-  regexSource   = packE . reSource
+  matchOnce             = flip (?=~)
+  matchMany             = flip (*=~)
+  makeRegexWith         = \o -> compileRegexWith o . unpackR
+  makeSearchReplaceWith = \o r t -> compileSearchReplaceWith o (unpackR r) (unpackR t)
+  regexSource           = packR . reSource
 
 -- $tutorial
--- We have a regex tutorial at <http://tutorial.regex.uk>. These API
--- docs are mainly for reference.
-
--- $toolkit
---
--- Beyond the above match operators and the regular expression type
--- below, "Text.RE" contains the toolkit for replacing captures,
--- specifying options, etc.
-
--- $re
---
--- "Text.RE.TDFA.RE" contains the toolkit specific to the 'RE' type,
--- the type generated by the gegex compiler.
+-- We have a regex tutorial at <http://tutorial.regex.uk>.
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
@@ -13,22 +13,36 @@
   (
   -- * Tutorial
   -- $tutorial
-
+  --
   -- * The Match Operators
     (*=~)
   , (?=~)
+  -- * The SearchReplace Operators
+  , (*=~/)
+  , (?=~/)
+  -- * The Classic rexex-base Match Operators
   , (=~)
   , (=~~)
-  -- * The Toolkit
-  -- $toolkit
-  , module Text.RE
-  -- * The 'RE' Type and functions
-  -- $re
+  -- * Matches
+  , Matches
+  , matchesSource
+  , allMatches
+  , anyMatches
+  , countMatches
+  , matches
+  -- * Match
+  , Match
+  , matchSource
+  , matched
+  , matchedText
+  -- * The 'RE' Type and Functions
   , RE
+  , SimpleREOptions(..)
   , reSource
   , compileRegex
   , compileRegexWith
   , escape
+  , escapeWith
   , module Text.RE.TDFA.RE
   ) where
 
@@ -37,8 +51,11 @@
 import           Data.Typeable
 import           Text.Regex.Base
 import           Text.RE
-import           Text.RE.Types.IsRegex
 import           Text.RE.Internal.AddCaptureNames
+import           Text.RE.SearchReplace
+import           Text.RE.Types.IsRegex
+import           Text.RE.Types.REOptions
+import           Text.RE.Types.Replace
 import           Text.RE.TDFA.RE
 import qualified Text.Regex.TDFA               as TDFA
 
@@ -55,6 +72,14 @@
       -> Match TL.Text
 (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs
 
+-- | search and replace once
+(?=~/) :: TL.Text -> SearchReplace RE TL.Text -> TL.Text
+(?=~/) = flip searchReplaceFirst
+
+-- | search and replace, all occurrences
+(*=~/) :: TL.Text -> SearchReplace RE TL.Text -> TL.Text
+(*=~/) = flip searchReplaceAll
+
 -- | the regex-base polymorphic match operator
 (=~) :: ( Typeable a
         , RegexContext TDFA.Regex TL.Text a
@@ -78,23 +103,11 @@
 (=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs
 
 instance IsRegex RE TL.Text where
-  matchOnce     = flip (?=~)
-  matchMany     = flip (*=~)
-  makeRegexWith = \o -> compileRegexWith o . unpackE
-  makeRegex     = compileRegex . unpackE
-  regexSource   = packE . reSource
+  matchOnce             = flip (?=~)
+  matchMany             = flip (*=~)
+  makeRegexWith         = \o -> compileRegexWith o . unpackR
+  makeSearchReplaceWith = \o r t -> compileSearchReplaceWith o (unpackR r) (unpackR t)
+  regexSource           = packR . reSource
 
 -- $tutorial
--- We have a regex tutorial at <http://tutorial.regex.uk>. These API
--- docs are mainly for reference.
-
--- $toolkit
---
--- Beyond the above match operators and the regular expression type
--- below, "Text.RE" contains the toolkit for replacing captures,
--- specifying options, etc.
-
--- $re
---
--- "Text.RE.TDFA.RE" contains the toolkit specific to the 'RE' type,
--- the type generated by the gegex compiler.
+-- We have a regex tutorial at <http://tutorial.regex.uk>.
