packages feed

regex-with-pcre (empty) → 0.6.0.0

raw patch · 11 files changed

+999/−0 lines, 11 filesdep +basedep +base-compatdep +bytestringsetup-changed

Dependencies added: base, base-compat, bytestring, containers, regex, regex-base, regex-pcre-builtin, template-haskell, transformers

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2016-2017, Chris Dornan++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Iris Connect nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.markdown view
@@ -0,0 +1,130 @@+# regex++regex is a regular expression toolkit for regex-base with:++  * text-replacement operations with named captures;+  * special datatypes for matches and captures;+  * compile-time checking of RE syntax;+  * a unified means of controlling case-sensitivity and multi-line options;+  * high-level AWK-like tools for building text processing apps;+  * the option of using match operators with reduced polymorphism on the+    text and/or result types;+  * regular expression macros including:+      + a number of useful RE macros;+      + a test bench for testing and documenting new macro environments;+  * built-in support for the TDFA and PCRE backends;+  * comprehensive documentation and copious examples.+++See the [About page](http://about.regex.uk) for details.+++## regex and regex-examples++The library and tutorial, tests and examples have been split across+two packages:++  * the `regex` package contains the regex library and+  * the `regex-examples` package contains the tutorial, tests+    and example programs.+++## Road Map++    ☒  2017-01-26  v0.0.0.1  Pre-release (I)++    ☒  2017-01-30  v0.0.0.2  Pre-release (II)++    ☒  2017-02-18  v0.1.0.0  [Proposed core API with presentable Haddocks](https://github.com/iconnect/regex/milestone/1)++    ☒  2017-02-19  v0.2.0.0  [Package split into regex and regex-examples](https://github.com/iconnect/regex/milestone/5)++    ☒  2017-02-20  v0.2.0.1  [Remove library from regex-examples](https://github.com/iconnect/regex/issues/43)++    ☒  2017-02-21  v0.2.0.2  [Fix tests for Hackage](https://github.com/iconnect/regex/issues/45)++    ☒  2017-02-21  v0.2.0.3  Tweak README/index layout++    ☒  2017-02-22  v0.2.0.4  [Repair re-gen-modules-test for Windows](https://github.com/iconnect/regex/issues/47)++    ☒  2017-02-26  v0.3.0.0  [API adjustments](https://github.com/iconnect/regex/milestone/2)++    ☒  2017-03-05  v0.5.0.0  [Ready for review: API, tutorials and examples finalized](https://github.com/iconnect/regex/milestone/6)++    ☒  2017-13-05  v0.6.0.0  [Split out PCRE](https://github.com/iconnect/regex/milestone/7)++    ☐  2017-03-20  v1.0.0.0  [First stable release](https://github.com/iconnect/regex/milestone/3)++    ☐  2017-08-31  v2.0.0.0  [Fast text replacement with benchmarks](https://github.com/iconnect/regex/milestone/4)++++See the [Roadmap page](http://roadmap.regex.uk) for details.+++## The regex blog++Check out the [regex blog](http://blog.regex.uk) for news articles and+discussion concerning all things regex.+++## Build Status++[![Hackage](http://regex.uk/badges/hackage.svg)](https://hackage.haskell.org/package/regex) [![BSD3 License](http://regex.uk/badges/license.svg)](https://tldrlegal.com/license/bsd-3-clause-license-%28revised%29) [![Un*x build](http://regex.uk/badges/unix-build.svg)](https://travis-ci.org/iconnect/regex) [![Windows build](http://regex.uk/badges/windows-build.svg)](https://ci.appveyor.com/project/engineerirngirisconnectcouk/regex/branch/master) [![Coverage](http://regex.uk/badges/coverage.svg)](https://coveralls.io/github/iconnect/regex?branch=master)++See [build status page](http://regex.uk/build-status) for details.+++## Installing the Package++The package can be easily installed with cabal or stack on GHC-8.0,+ 7.10 or 7.8 for the above platforms. See the+[Installation page](http://installation.regex.uk) for details.+++## The Tutorial Tests and Examples++See the [Tutorial page](http://tutorial.regex.uk) and+[Examples page](http://examples.regex.uk) for details.+++## Helping Out++If you have any feedback or suggestion then please drop us a line.++    `t` [@hregex](https://twitter.com/hregex)++    `e` maintainers@regex.uk++    `w` http://issues.regex.uk++The [Contact page](http://contact.regex.uk) has more details.+++## The API++The Haddocks can be found at http://hs.regex.uk.+++## The Macro Tables++The macro environments are an important part of the package and+are documented [here](http://macros.regex.uk).+++## The regex.uk Directory++A handy overview of the regex.uk domain can be found+[here](http://directory.regex.uk).+++## The Changelog++The `changelog` is posted [here](http://changelog.regex.uk).+++## The Authors++This library was written and is currently maintained by+[Chris Dornan](mailto:chris.dornan@irisconnect.com) aka+[@cdornan](https://twitter.com/cdornan)
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ Text/RE/PCRE.hs view
@@ -0,0 +1,96 @@+{-# LANGUAGE FlexibleContexts           #-}+{-# LANGUAGE CPP                        #-}+#if __GLASGOW_HASKELL__ >= 800+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+#endif+{-# OPTIONS_GHC -fno-warn-dodgy-exports #-}++module Text.RE.PCRE+  (+  -- * Tutorial+  -- $tutorial++  -- * The Overloaded Match Operators+    (*=~)+  , (?=~)+  , (=~)+  , (=~~)+  -- * The Toolkit+  -- $toolkit+  , module Text.RE+  -- * The 'RE' Type+  -- $re+  , module Text.RE.PCRE.RE+  -- * The Operator Instances+  -- $instances+  , module Text.RE.PCRE.ByteString+  , module Text.RE.PCRE.ByteString.Lazy+  , module Text.RE.PCRE.Sequence+  , module Text.RE.PCRE.String++  ) where+++import qualified Text.Regex.Base                          as B+import           Text.RE+import           Text.RE.Internal.AddCaptureNames+import           Text.RE.PCRE.RE+import qualified Text.Regex.PCRE                          as PCRE+import           Text.RE.PCRE.ByteString()+import           Text.RE.PCRE.ByteString.Lazy()+import           Text.RE.PCRE.Sequence()+import           Text.RE.PCRE.String()+++-- | find all matches in text+(*=~) :: IsRegex RE s+      => s+      -> RE+      -> Matches s+(*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ matchMany rex bs++-- | find first match in text+(?=~) :: IsRegex RE s+      => s+      -> RE+      -> Match s+(?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ matchOnce rex bs++-- | the regex-base polymorphic match operator+(=~) :: ( B.RegexContext PCRE.Regex s a+        , B.RegexMaker   PCRE.Regex PCRE.CompOption PCRE.ExecOption s+        )+     => s+     -> RE+     -> a+(=~) bs rex = B.match (reRegex rex) bs++-- | the regex-base monadic, polymorphic match operator+(=~~) :: ( Monad m+         , B.RegexContext PCRE.Regex s a+         , B.RegexMaker   PCRE.Regex PCRE.CompOption PCRE.ExecOption s+         )+      => s+      -> RE+      -> m a+(=~~) bs rex = B.matchM (reRegex rex) bs++-- $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.++-- $instances+--+-- These modules merely provide the instances for the above regex+-- match operators at the various text types.
+ Text/RE/PCRE/ByteString.hs view
@@ -0,0 +1,91 @@+{-# LANGUAGE NoImplicitPrelude          #-}+{-# LANGUAGE MultiParamTypeClasses      #-}+{-# LANGUAGE FlexibleContexts           #-}+{-# LANGUAGE FlexibleInstances          #-}+{-# OPTIONS_GHC -fno-warn-orphans       #-}+{-# LANGUAGE CPP                        #-}+#if __GLASGOW_HASKELL__ >= 800+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+#endif++module Text.RE.PCRE.ByteString+  (+  -- * Tutorial+  -- $tutorial++  -- * The Match Operators+    (*=~)+  , (?=~)+  , (=~)+  , (=~~)+  -- * The Toolkit+  -- $toolkit+  , module Text.RE+  -- * The 'RE' Type+  -- $re+  , module Text.RE.PCRE.RE+  ) where++import           Prelude.Compat+import qualified Data.ByteString               as B+import           Data.Typeable+import           Text.Regex.Base+import           Text.RE+import           Text.RE.Internal.AddCaptureNames+import           Text.RE.PCRE.RE+import qualified Text.Regex.PCRE               as PCRE+++-- | find all matches in text+(*=~) :: B.ByteString+      -> RE+      -> Matches B.ByteString+(*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs++-- | find first match in text+(?=~) :: B.ByteString+      -> RE+      -> Match B.ByteString+(?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs++-- | the regex-base polymorphic match operator+(=~) :: ( Typeable a+        , RegexContext PCRE.Regex B.ByteString a+        , RegexMaker   PCRE.Regex PCRE.CompOption PCRE.ExecOption String+        )+     => B.ByteString+     -> RE+     -> a+(=~) bs rex = addCaptureNames (reCaptureNames rex) $ match (reRegex rex) bs++-- | the regex-base monadic, polymorphic match operator+(=~~) :: ( Monad m+         , Functor m+         , Typeable a+         , RegexContext PCRE.Regex B.ByteString a+         , RegexMaker   PCRE.Regex PCRE.CompOption PCRE.ExecOption String+         )+      => B.ByteString+      -> RE+      -> m a+(=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs++instance IsRegex RE B.ByteString where+  matchOnce   = flip (?=~)+  matchMany   = flip (*=~)+  regexSource = 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.
+ Text/RE/PCRE/ByteString/Lazy.hs view
@@ -0,0 +1,91 @@+{-# LANGUAGE NoImplicitPrelude          #-}+{-# LANGUAGE MultiParamTypeClasses      #-}+{-# LANGUAGE FlexibleContexts           #-}+{-# LANGUAGE FlexibleInstances          #-}+{-# OPTIONS_GHC -fno-warn-orphans       #-}+{-# LANGUAGE CPP                        #-}+#if __GLASGOW_HASKELL__ >= 800+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+#endif++module Text.RE.PCRE.ByteString.Lazy+  (+  -- * Tutorial+  -- $tutorial++  -- * The Match Operators+    (*=~)+  , (?=~)+  , (=~)+  , (=~~)+  -- * The Toolkit+  -- $toolkit+  , module Text.RE+  -- * The 'RE' Type+  -- $re+  , module Text.RE.PCRE.RE+  ) where++import           Prelude.Compat+import qualified Data.ByteString.Lazy          as LBS+import           Data.Typeable+import           Text.Regex.Base+import           Text.RE+import           Text.RE.Internal.AddCaptureNames+import           Text.RE.PCRE.RE+import qualified Text.Regex.PCRE               as PCRE+++-- | find all matches in text+(*=~) :: LBS.ByteString+      -> RE+      -> Matches LBS.ByteString+(*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs++-- | find first match in text+(?=~) :: LBS.ByteString+      -> RE+      -> Match LBS.ByteString+(?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs++-- | the regex-base polymorphic match operator+(=~) :: ( Typeable a+        , RegexContext PCRE.Regex LBS.ByteString a+        , RegexMaker   PCRE.Regex PCRE.CompOption PCRE.ExecOption String+        )+     => LBS.ByteString+     -> RE+     -> a+(=~) bs rex = addCaptureNames (reCaptureNames rex) $ match (reRegex rex) bs++-- | the regex-base monadic, polymorphic match operator+(=~~) :: ( Monad m+         , Functor m+         , Typeable a+         , RegexContext PCRE.Regex LBS.ByteString a+         , RegexMaker   PCRE.Regex PCRE.CompOption PCRE.ExecOption String+         )+      => LBS.ByteString+      -> RE+      -> m a+(=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs++instance IsRegex RE LBS.ByteString where+  matchOnce   = flip (?=~)+  matchMany   = flip (*=~)+  regexSource = 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.
+ Text/RE/PCRE/RE.hs view
@@ -0,0 +1,252 @@+{-# LANGUAGE NoImplicitPrelude          #-}+{-# LANGUAGE RecordWildCards            #-}+{-# LANGUAGE QuasiQuotes                #-}+{-# LANGUAGE TemplateHaskell            #-}+{-# LANGUAGE MultiParamTypeClasses      #-}+{-# LANGUAGE TypeSynonymInstances       #-}+{-# LANGUAGE FlexibleInstances          #-}+{-# LANGUAGE FlexibleContexts           #-}+{-# LANGUAGE CPP                        #-}+#if __GLASGOW_HASKELL__ >= 800+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+#endif+{-# OPTIONS_GHC -fno-warn-orphans       #-}++module Text.RE.PCRE.RE+  ( re+  , reMS+  , reMI+  , reBS+  , reBI+  , reMultilineSensitive+  , reMultilineInsensitive+  , reBlockSensitive+  , reBlockInsensitive+  , re_+  , cp+  , regexType+  , RE+  , reOptions+  , reSource+  , reCaptureNames+  , reRegex+  , Options+  , prelude+  , preludeEnv+  , preludeTestsFailing+  , preludeTable+  , preludeSummary+  , preludeSources+  , preludeSource+  , noPreludeOptions+  , defaultOptions+  , unpackSimpleRegexOptions+  , compileRegex+  , escape+  , escapeREString+  ) where++import           Data.Bits+import           Data.Functor.Identity+import           Language.Haskell.TH+import           Language.Haskell.TH.Quote+import           Prelude.Compat+import           Text.RE+import           Text.RE.Internal.EscapeREString+import           Text.RE.Internal.NamedCaptures+import           Text.RE.Internal.PreludeMacros+import           Text.RE.Internal.QQ+import           Text.RE.TestBench+import           Text.Regex.PCRE+++re+  , reMS+  , reMI+  , reBS+  , reBI+  , reMultilineSensitive+  , reMultilineInsensitive+  , reBlockSensitive+  , reBlockInsensitive+  , re_ :: QuasiQuoter++re                       = re' $ Just minBound+reMS                     = reMultilineSensitive+reMI                     = reMultilineInsensitive+reBS                     = reBlockSensitive+reBI                     = reBlockInsensitive+reMultilineSensitive     = re' $ Just  MultilineSensitive+reMultilineInsensitive   = re' $ Just  MultilineInsensitive+reBlockSensitive         = re' $ Just  BlockSensitive+reBlockInsensitive       = re' $ Just  BlockInsensitive+re_                      = re'   Nothing++regexType :: RegexType+regexType =+  PCRE $ \txt env md -> txt =~ mdRegexSource regexType ExclCaptures env md++data RE =+  RE+    { _re_options :: !Options+    , _re_source  :: !String+    , _re_cnames  :: !CaptureNames+    , _re_regex   :: !Regex+    }++reOptions :: RE -> Options+reOptions = _re_options++reSource :: RE -> String+reSource = _re_source++reCaptureNames :: RE -> CaptureNames+reCaptureNames = _re_cnames++reRegex  :: RE -> Regex+reRegex = _re_regex++type Options = Options_ RE CompOption ExecOption++instance IsOption SimpleRegexOptions RE CompOption ExecOption where+  makeOptions    = unpackSimpleRegexOptions++instance IsOption (Macros RE) RE CompOption ExecOption where+  makeOptions ms = Options ms def_comp_option def_exec_option++instance IsOption CompOption  RE CompOption ExecOption where+  makeOptions co = Options prelude co def_exec_option++instance IsOption ExecOption  RE CompOption ExecOption where+  makeOptions eo = Options prelude def_comp_option eo++instance IsOption Options     RE CompOption ExecOption where+  makeOptions    = id++instance IsOption ()          RE CompOption ExecOption where+  makeOptions _  = unpackSimpleRegexOptions minBound++def_comp_option :: CompOption+def_comp_option = optionsComp defaultOptions++def_exec_option :: ExecOption+def_exec_option = optionsExec defaultOptions++noPreludeOptions :: Options+noPreludeOptions = defaultOptions { optionsMacs = emptyMacros }++defaultOptions :: Options+defaultOptions = makeOptions (minBound::SimpleRegexOptions)++unpackSimpleRegexOptions :: SimpleRegexOptions -> Options+unpackSimpleRegexOptions sro =+  Options+    { optionsMacs = prelude+    , optionsComp = comp+    , optionsExec = defaultExecOpt+    }+  where+    comp =+      wiggle ml compMultiline $+      wiggle ci compCaseless+        defaultCompOpt++    wiggle True  m v = v .|.            m+    wiggle False m v = v .&. complement m++    (ml,ci) = case sro of+        MultilineSensitive    -> (,) True  False+        MultilineInsensitive  -> (,) True  True+        BlockSensitive        -> (,) False False+        BlockInsensitive      -> (,) False True++compileRegex :: ( IsOption o RE CompOption ExecOption+                , Functor m+                , Monad   m+                )+             => o+             -> String+             -> m RE+compileRegex = compileRegex_ . makeOptions++compileRegex_ :: ( Functor m , Monad m )+              => Options+              -> String+              -> m RE+compileRegex_ os re_s = uncurry mk <$> compileRegex' os re_s+  where+    mk cnms rex =+      RE+        { _re_options = os+        , _re_source  = re_s+        , _re_cnames  = cnms+        , _re_regex   = rex+        }++re' :: Maybe SimpleRegexOptions -> QuasiQuoter+re' mb = case mb of+  Nothing  ->+    (qq0 "re_")+      { quoteExp = parse minBound (\rs->[|flip unsafeCompileRegex rs|])+      }+  Just sro ->+    (qq0 "re")+      { quoteExp = parse sro (\rs->[|unsafeCompileRegexSimple sro rs|])+      }+  where+    parse :: SimpleRegexOptions -> (String->Q Exp) -> String -> Q Exp+    parse sro mk rs = either error (\_->mk rs) $ compileRegex_ os rs+      where+        os = unpackSimpleRegexOptions sro++unsafeCompileRegexSimple :: SimpleRegexOptions -> String -> RE+unsafeCompileRegexSimple sro re_s = unsafeCompileRegex os re_s+  where+    os = unpackSimpleRegexOptions sro++unsafeCompileRegex :: IsOption o RE CompOption ExecOption+                   => o+                   -> String+                   -> RE+unsafeCompileRegex = unsafeCompileRegex_ . makeOptions++unsafeCompileRegex_ :: Options -> String -> RE+unsafeCompileRegex_ os = either oops id . compileRegex os+  where+    oops = error . ("unsafeCompileRegex: " ++)++compileRegex' :: (Functor m,Monad m)+              => Options+              -> String+              -> m (CaptureNames,Regex)+compileRegex' Options{..} s0 = do+    (cnms,s2) <- either fail return $ extractNamedCaptures s1+    (,) cnms <$> makeRegexOptsM optionsComp optionsExec s2+  where+    s1 = expandMacros reSource optionsMacs s0++prelude :: Macros RE+prelude = runIdentity $ preludeMacros mk regexType ExclCaptures+  where+    mk = Identity . unsafeCompileRegex_ noPreludeOptions++preludeTestsFailing :: [MacroID]+preludeTestsFailing = badMacros preludeEnv++preludeEnv :: MacroEnv+preludeEnv = preludeMacroEnv regexType++preludeTable :: String+preludeTable = preludeMacroTable regexType++preludeSummary :: PreludeMacro -> String+preludeSummary = preludeMacroSummary regexType++preludeSources :: String+preludeSources = preludeMacroSources regexType++preludeSource :: PreludeMacro -> String+preludeSource = preludeMacroSource regexType++escape :: (String->String) -> String -> RE+escape f = unsafeCompileRegex () . f . escapeREString
+ Text/RE/PCRE/Sequence.hs view
@@ -0,0 +1,91 @@+{-# LANGUAGE NoImplicitPrelude          #-}+{-# LANGUAGE MultiParamTypeClasses      #-}+{-# LANGUAGE FlexibleContexts           #-}+{-# LANGUAGE FlexibleInstances          #-}+{-# OPTIONS_GHC -fno-warn-orphans       #-}+{-# LANGUAGE CPP                        #-}+#if __GLASGOW_HASKELL__ >= 800+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+#endif++module Text.RE.PCRE.Sequence+  (+  -- * Tutorial+  -- $tutorial++  -- * The Match Operators+    (*=~)+  , (?=~)+  , (=~)+  , (=~~)+  -- * The Toolkit+  -- $toolkit+  , module Text.RE+  -- * The 'RE' Type+  -- $re+  , module Text.RE.PCRE.RE+  ) where++import           Prelude.Compat+import qualified Data.Sequence                 as S+import           Data.Typeable+import           Text.Regex.Base+import           Text.RE+import           Text.RE.Internal.AddCaptureNames+import           Text.RE.PCRE.RE+import qualified Text.Regex.PCRE               as PCRE+++-- | find all matches in text+(*=~) :: (S.Seq Char)+      -> RE+      -> Matches (S.Seq Char)+(*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs++-- | find first match in text+(?=~) :: (S.Seq Char)+      -> RE+      -> Match (S.Seq Char)+(?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs++-- | the regex-base polymorphic match operator+(=~) :: ( Typeable a+        , RegexContext PCRE.Regex (S.Seq Char) a+        , RegexMaker   PCRE.Regex PCRE.CompOption PCRE.ExecOption String+        )+     => (S.Seq Char)+     -> RE+     -> a+(=~) bs rex = addCaptureNames (reCaptureNames rex) $ match (reRegex rex) bs++-- | the regex-base monadic, polymorphic match operator+(=~~) :: ( Monad m+         , Functor m+         , Typeable a+         , RegexContext PCRE.Regex (S.Seq Char) a+         , RegexMaker   PCRE.Regex PCRE.CompOption PCRE.ExecOption String+         )+      => (S.Seq Char)+      -> RE+      -> m a+(=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs++instance IsRegex RE (S.Seq Char) where+  matchOnce   = flip (?=~)+  matchMany   = flip (*=~)+  regexSource = 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.
+ Text/RE/PCRE/String.hs view
@@ -0,0 +1,91 @@+{-# LANGUAGE NoImplicitPrelude          #-}+{-# LANGUAGE MultiParamTypeClasses      #-}+{-# LANGUAGE FlexibleContexts           #-}+{-# LANGUAGE FlexibleInstances          #-}+{-# OPTIONS_GHC -fno-warn-orphans       #-}+{-# LANGUAGE CPP                        #-}+#if __GLASGOW_HASKELL__ >= 800+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+#endif++module Text.RE.PCRE.String+  (+  -- * Tutorial+  -- $tutorial++  -- * The Match Operators+    (*=~)+  , (?=~)+  , (=~)+  , (=~~)+  -- * The Toolkit+  -- $toolkit+  , module Text.RE+  -- * The 'RE' Type+  -- $re+  , module Text.RE.PCRE.RE+  ) where++import           Prelude.Compat++import           Data.Typeable+import           Text.Regex.Base+import           Text.RE+import           Text.RE.Internal.AddCaptureNames+import           Text.RE.PCRE.RE+import qualified Text.Regex.PCRE               as PCRE+++-- | find all matches in text+(*=~) :: String+      -> RE+      -> Matches String+(*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs++-- | find first match in text+(?=~) :: String+      -> RE+      -> Match String+(?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs++-- | the regex-base polymorphic match operator+(=~) :: ( Typeable a+        , RegexContext PCRE.Regex String a+        , RegexMaker   PCRE.Regex PCRE.CompOption PCRE.ExecOption String+        )+     => String+     -> RE+     -> a+(=~) bs rex = addCaptureNames (reCaptureNames rex) $ match (reRegex rex) bs++-- | the regex-base monadic, polymorphic match operator+(=~~) :: ( Monad m+         , Functor m+         , Typeable a+         , RegexContext PCRE.Regex String a+         , RegexMaker   PCRE.Regex PCRE.CompOption PCRE.ExecOption String+         )+      => String+      -> RE+      -> m a+(=~~) bs rex = addCaptureNames (reCaptureNames rex) <$> matchM (reRegex rex) bs++instance IsRegex RE String where+  matchOnce   = flip (?=~)+  matchMany   = flip (*=~)+  regexSource = 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.
+ changelog view
@@ -0,0 +1,59 @@+-*-change-log-*-++0.6.0.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-03-13+  * Split out rexex-with-pcre package (#65)++0.5.0.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-03-05+  * Fix inter-operation of =~ & =~~ and named captures (#55)+  * Add escaping functions (#37)+  * Test Hackage release tarballs on Travis CI (#51)+  * Fix up template replace ordinals (#52)+  * Complete the web site (#39)+  * Complete the Tutorial, Tests and Examples (#38)+  * Complete narrative in literate modules (#8)++0.3.0.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-02-26+  * Clean up API to use camelCase conventions+  * Use -Werror in development and testing, -Warn for Hackage+  * Integrate the regex blog+  * Better presentation of ghci tryouts in the Tutorial+  * Various minor README upgrades and fixes++0.2.0.4 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-02-22+  * Repair re-gen-modules-test for Windows++0.2.0.3 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-02-21+  * README/index layout tweak++0.2.0.2 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-02-21+  * Fix re-gen-modules-test for Hackage (#45)+  * Minor style tweks to README/index++0.2.0.1 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-02-20+  * remove library from regex-examples (#43)++0.2.0.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-02-19+  * Split off the tutorial tests and examples into regex-examples,+    leaving just the library in regex++0.1.0.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-02-18+  * Cabal file generated from a DRY template+  * Library dependencies minimised, test depndencies moved into+    examples/re-tests+  * A proper static website generated by 're-prep all'+  * README/sidebar Badges are a static record of current release+    with links to a live build-status reporting on HEAD+  * Added !$, !$?, !$$ and !$$? alternatives for looking up captures+    in a Match+  * Text.RE.Parsers now generate Text where they were generating String+  * %nat, %int, %frac and %hex get their new names++0.0.0.2 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-01-30+  * Fix for Windows+  * Remove hsyslog dependency+  * Establish Travis CI, AppVeyor and coveralls.io integrations+  * Fix time parser to use Fixed arithmetic+  * Miscelaneous minor adjustments++0.0.0.1 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-01-26+	* First public release
+ regex-with-pcre.cabal view
@@ -0,0 +1,66 @@+Name:                   regex-with-pcre+Version:                0.6.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+                        matches and captures, a text replacement toolkit,+                        portable options, high-level AWK-like tools+                        for building text processing apps, regular expression+                        macros and test bench, a tutorial and copious examples.+Homepage:               http://regex.uk+Author:                 Chris Dornan+License:                BSD3+license-file:           LICENSE+Maintainer:             Chris Dornan <chris@regex.uk>+Copyright:              Chris Dornan 2016-2017+Category:               Text+Build-type:             Simple+Stability:              RFC+bug-reports:            http://issues.regex.uk++Extra-Source-Files:+    README.markdown+    changelog++Cabal-Version:          >= 1.16++Source-Repository head+    type:               git+    location:           https://github.com/iconnect/regex.git++Source-Repository this+    Type:               git+    Location:           https://github.com/iconnect/regex.git+    Tag:                0.6.0.0++++Library+    Hs-Source-Dirs:     .+    Exposed-Modules:+      Text.RE.PCRE+      Text.RE.PCRE.ByteString+      Text.RE.PCRE.ByteString.Lazy+      Text.RE.PCRE.RE+      Text.RE.PCRE.Sequence+      Text.RE.PCRE.String++    Default-Language:   Haskell2010+    GHC-Options:+      -Wall+      -fwarn-tabs+      -Wwarn++    Build-depends:+        regex                == 0.6.0.0+      , base                 >= 4 && < 5+      , base-compat          >= 0.6.0+      , bytestring           >= 0.10.2.0+      , containers           >= 0.4+      , regex-base           >= 0.93.2+      , regex-pcre-builtin   >= 0.94.4.8.8.35+      , template-haskell     >= 2.7+      , transformers         >= 0.2.2+++-- Generated with re-gen-cabals