packages feed

regex-with-pcre 0.11.0.0 → 0.11.1.0

raw patch · 13 files changed

+380/−119 lines, 13 filesdep ~regexPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: regex

API changes (from Hackage documentation)

- Text.RE.PCRE: ed :: QuasiQuoter
- Text.RE.PCRE: edBI :: QuasiQuoter
- Text.RE.PCRE: edBS :: QuasiQuoter
- Text.RE.PCRE: edBlockInsensitive :: QuasiQuoter
- Text.RE.PCRE: edBlockSensitive :: QuasiQuoter
- Text.RE.PCRE: edMI :: QuasiQuoter
- Text.RE.PCRE: edMS :: QuasiQuoter
- Text.RE.PCRE: edMultilineInsensitive :: QuasiQuoter
- Text.RE.PCRE: edMultilineSensitive :: QuasiQuoter
- Text.RE.PCRE: ed_ :: QuasiQuoter
- Text.RE.PCRE.ByteString: ed :: QuasiQuoter
- Text.RE.PCRE.ByteString: edBI :: QuasiQuoter
- Text.RE.PCRE.ByteString: edBS :: QuasiQuoter
- Text.RE.PCRE.ByteString: edBlockInsensitive :: QuasiQuoter
- Text.RE.PCRE.ByteString: edBlockSensitive :: QuasiQuoter
- Text.RE.PCRE.ByteString: edMI :: QuasiQuoter
- Text.RE.PCRE.ByteString: edMS :: QuasiQuoter
- Text.RE.PCRE.ByteString: edMultilineInsensitive :: QuasiQuoter
- Text.RE.PCRE.ByteString: edMultilineSensitive :: QuasiQuoter
- Text.RE.PCRE.ByteString: ed_ :: QuasiQuoter
- Text.RE.PCRE.ByteString.Lazy: ed :: QuasiQuoter
- Text.RE.PCRE.ByteString.Lazy: edBI :: QuasiQuoter
- Text.RE.PCRE.ByteString.Lazy: edBS :: QuasiQuoter
- Text.RE.PCRE.ByteString.Lazy: edBlockInsensitive :: QuasiQuoter
- Text.RE.PCRE.ByteString.Lazy: edBlockSensitive :: QuasiQuoter
- Text.RE.PCRE.ByteString.Lazy: edMI :: QuasiQuoter
- Text.RE.PCRE.ByteString.Lazy: edMS :: QuasiQuoter
- Text.RE.PCRE.ByteString.Lazy: edMultilineInsensitive :: QuasiQuoter
- Text.RE.PCRE.ByteString.Lazy: edMultilineSensitive :: QuasiQuoter
- Text.RE.PCRE.ByteString.Lazy: ed_ :: QuasiQuoter
- Text.RE.PCRE.Sequence: ed :: QuasiQuoter
- Text.RE.PCRE.Sequence: edBI :: QuasiQuoter
- Text.RE.PCRE.Sequence: edBS :: QuasiQuoter
- Text.RE.PCRE.Sequence: edBlockInsensitive :: QuasiQuoter
- Text.RE.PCRE.Sequence: edBlockSensitive :: QuasiQuoter
- Text.RE.PCRE.Sequence: edMI :: QuasiQuoter
- Text.RE.PCRE.Sequence: edMS :: QuasiQuoter
- Text.RE.PCRE.Sequence: edMultilineInsensitive :: QuasiQuoter
- Text.RE.PCRE.Sequence: edMultilineSensitive :: QuasiQuoter
- Text.RE.PCRE.Sequence: ed_ :: QuasiQuoter
- Text.RE.PCRE.String: ed :: QuasiQuoter
- Text.RE.PCRE.String: edBI :: QuasiQuoter
- Text.RE.PCRE.String: edBS :: QuasiQuoter
- Text.RE.PCRE.String: edBlockInsensitive :: QuasiQuoter
- Text.RE.PCRE.String: edBlockSensitive :: QuasiQuoter
- Text.RE.PCRE.String: edMI :: QuasiQuoter
- Text.RE.PCRE.String: edMS :: QuasiQuoter
- Text.RE.PCRE.String: edMultilineInsensitive :: QuasiQuoter
- Text.RE.PCRE.String: edMultilineSensitive :: QuasiQuoter
- Text.RE.PCRE.String: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace: compileSearchAndReplace_ :: (Monad m, Functor m) => (String -> s) -> (String -> Either String re) -> String -> String -> m (SearchReplace re s)
+ Text.RE.ZeInternals.SearchReplace: compileSearchReplace_ :: (Monad m, Functor m) => (String -> s) -> (String -> Either String re) -> String -> m (SearchReplace re s)
+ Text.RE.ZeInternals.SearchReplace: unsafeCompileSearchReplace_ :: (String -> s) -> (String -> Either String re) -> String -> SearchReplace re s
+ Text.RE.ZeInternals.SearchReplace.PCRE: ed :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE: edBI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE: edBS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE: edBlockInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE: edBlockSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE: edMI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE: edMS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE: edMultilineInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE: edMultilineSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString: ed :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString: edBI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString: edBS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString: edBlockInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString: edBlockSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString: edMI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString: edMS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString: edMultilineInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString: edMultilineSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy: ed :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy: edBI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy: edBS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy: edBlockInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy: edBlockSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy: edMI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy: edMS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy: edMultilineInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy: edMultilineSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.Sequence: ed :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.Sequence: edBI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.Sequence: edBS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.Sequence: edBlockInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.Sequence: edBlockSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.Sequence: edMI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.Sequence: edMS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.Sequence: edMultilineInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.Sequence: edMultilineSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.Sequence: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.String: ed :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.String: edBI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.String: edBS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.String: edBlockInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.String: edBlockSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.String: edMI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.String: edMS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.String: edMultilineInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.String: edMultilineSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCRE.String: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.PCREEdPrime: ed' :: Q Exp -> Maybe SimpleREOptions -> QuasiQuoter

Files

Text/RE/PCRE.hs view
@@ -20,9 +20,6 @@   -- * The SearchReplace Operators   , (*=~/)   , (?=~/)-  -- * The Classic rexex-base Match Operators-  , (=~)-  , (=~~)   -- * Matches   , Matches   , matchesSource@@ -35,17 +32,25 @@   , matchSource   , matched   , matchedText-  -- * The 'RE' Type and Functions+  -- * The 'RE' Type   , RE-  , SimpleREOptions(..)   , reSource+  -- * Options+  -- $options+  , SimpleREOptions(..)+  -- * Compiling and Escaping REs   , compileRegex   , compileRegexWith   , escape   , escapeWith   , escapeREString+  -- * The Classic rexex-base Match Operators+  , (=~)+  , (=~~)+  -- * The Quasi Quoters and Minor Functions+  -- $re   , module Text.RE.ZeInternals.PCRE-  -- * The [ed| ... |] quasi quoters+  -- $ed   , module Text.RE.ZeInternals.SearchReplace.PCRE   -- * The Operator Instances   -- $instances@@ -71,7 +76,8 @@ import           Text.RE.REOptions  --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- --   @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -81,21 +87,35 @@       -> Matches s (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ matchMany rex bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+--   @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: IsRegex RE s       => s       -> RE       -> Match s (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ matchOnce rex bs --- | search and replace once-(?=~/) :: IsRegex RE s => s -> SearchReplace RE s -> s-(?=~/) = flip searchReplaceFirst---- | search and replace, all occurrences+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date:+--+--   @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@+-- (*=~/) :: IsRegex RE s => s -> SearchReplace RE s -> s (*=~/) = flip searchReplaceAll +-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+--  @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+--+(?=~/) :: IsRegex RE s => s -> SearchReplace RE s -> s+(?=~/) = flip searchReplaceFirst+ -- | the regex-base polymorphic match operator (=~) :: ( B.RegexContext PCRE.Regex s a         , B.RegexMaker   PCRE.Regex PCRE.CompOption PCRE.ExecOption s@@ -120,7 +140,7 @@  -- $about -- This module provides access to the back end through polymorphic functions--- that operate over all of the String/Text/ByteString types supported by the+-- that operate over all of the String\/Text\/ByteString types supported by the -- PCRE back end. If you don't need this generality you might find it easier -- to work with one of the modules that have been specialised for each of these -- types:@@ -131,6 +151,35 @@ -- * "Text.RE.PCRE.Sequence" -- * "Text.RE.PCRE.String" --- $instances+-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section, --+--  @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+--  @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").++-- $instances -- These modules merely provide the 'IsRegex' instances.
Text/RE/PCRE/ByteString.hs view
@@ -20,9 +20,6 @@   -- * The 'SearchReplace' Operators   , (*=~/)   , (?=~/)-  -- * The Classic rexex-base match Operators-  , (=~)-  , (=~~)   -- * Matches   , Matches   , matchesSource@@ -35,16 +32,25 @@   , matchSource   , matched   , matchedText-  -- * The 'RE' Type and Functions+  -- * The 'RE' Type   , RE-  , SimpleREOptions(..)   , reSource+  -- * Options+  -- $options+  , SimpleREOptions(..)+  -- * Compiling and Escaping REs   , compileRegex   , compileRegexWith   , escape   , escapeWith   , escapeREString+  -- * The Classic rexex-base Match Operators+  , (=~)+  , (=~~)+  -- * The Quasi Quoters and Minor Functions+  -- $re   , module Text.RE.ZeInternals.PCRE+  -- $ed   , module Text.RE.ZeInternals.SearchReplace.PCRE.ByteString   ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.PCRE               as PCRE  --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- --   @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@       -> Matches B.ByteString (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+--   @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: B.ByteString       -> RE       -> Match B.ByteString (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: -----   @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+--   @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: B.ByteString -> SearchReplace RE B.ByteString -> B.ByteString (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+--  @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: B.ByteString -> SearchReplace RE B.ByteString -> B.ByteString (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@  -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+--  @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+--  @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").
Text/RE/PCRE/ByteString/Lazy.hs view
@@ -20,9 +20,6 @@   -- * The 'SearchReplace' Operators   , (*=~/)   , (?=~/)-  -- * The Classic rexex-base match Operators-  , (=~)-  , (=~~)   -- * Matches   , Matches   , matchesSource@@ -35,16 +32,25 @@   , matchSource   , matched   , matchedText-  -- * The 'RE' Type and Functions+  -- * The 'RE' Type   , RE-  , SimpleREOptions(..)   , reSource+  -- * Options+  -- $options+  , SimpleREOptions(..)+  -- * Compiling and Escaping REs   , compileRegex   , compileRegexWith   , escape   , escapeWith   , escapeREString+  -- * The Classic rexex-base Match Operators+  , (=~)+  , (=~~)+  -- * The Quasi Quoters and Minor Functions+  -- $re   , module Text.RE.ZeInternals.PCRE+  -- $ed   , module Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy   ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.PCRE               as PCRE  --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- --   @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@       -> Matches LBS.ByteString (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+--   @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: LBS.ByteString       -> RE       -> Match LBS.ByteString (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: -----   @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+--   @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: LBS.ByteString -> SearchReplace RE LBS.ByteString -> LBS.ByteString (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+--  @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: LBS.ByteString -> SearchReplace RE LBS.ByteString -> LBS.ByteString (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@  -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+--  @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+--  @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").
Text/RE/PCRE/Sequence.hs view
@@ -20,9 +20,6 @@   -- * The 'SearchReplace' Operators   , (*=~/)   , (?=~/)-  -- * The Classic rexex-base match Operators-  , (=~)-  , (=~~)   -- * Matches   , Matches   , matchesSource@@ -35,16 +32,25 @@   , matchSource   , matched   , matchedText-  -- * The 'RE' Type and Functions+  -- * The 'RE' Type   , RE-  , SimpleREOptions(..)   , reSource+  -- * Options+  -- $options+  , SimpleREOptions(..)+  -- * Compiling and Escaping REs   , compileRegex   , compileRegexWith   , escape   , escapeWith   , escapeREString+  -- * The Classic rexex-base Match Operators+  , (=~)+  , (=~~)+  -- * The Quasi Quoters and Minor Functions+  -- $re   , module Text.RE.ZeInternals.PCRE+  -- $ed   , module Text.RE.ZeInternals.SearchReplace.PCRE.Sequence   ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.PCRE               as PCRE  --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- --   @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@       -> Matches (S.Seq Char) (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+--   @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: (S.Seq Char)       -> RE       -> Match (S.Seq Char) (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: -----   @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+--   @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: (S.Seq Char) -> SearchReplace RE (S.Seq Char) -> (S.Seq Char) (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+--  @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: (S.Seq Char) -> SearchReplace RE (S.Seq Char) -> (S.Seq Char) (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@  -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+--  @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+--  @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").
Text/RE/PCRE/String.hs view
@@ -20,9 +20,6 @@   -- * The 'SearchReplace' Operators   , (*=~/)   , (?=~/)-  -- * The Classic rexex-base match Operators-  , (=~)-  , (=~~)   -- * Matches   , Matches   , matchesSource@@ -35,16 +32,25 @@   , matchSource   , matched   , matchedText-  -- * The 'RE' Type and Functions+  -- * The 'RE' Type   , RE-  , SimpleREOptions(..)   , reSource+  -- * Options+  -- $options+  , SimpleREOptions(..)+  -- * Compiling and Escaping REs   , compileRegex   , compileRegexWith   , escape   , escapeWith   , escapeREString+  -- * The Classic rexex-base Match Operators+  , (=~)+  , (=~~)+  -- * The Quasi Quoters and Minor Functions+  -- $re   , module Text.RE.ZeInternals.PCRE+  -- $ed   , module Text.RE.ZeInternals.SearchReplace.PCRE.String   ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.PCRE               as PCRE  --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- --   @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@       -> Matches String (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+--   @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: String       -> RE       -> Match String (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: -----   @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+--   @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: String -> SearchReplace RE String -> String (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+--  @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: String -> SearchReplace RE String -> String (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@  -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+--  @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+--  @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").
Text/RE/ZeInternals/PCRE.hs view
@@ -183,7 +183,7 @@ -- | compile a 'String' into a 'RE' with the default options, -- generating an error if the RE is not well formed compileRegex :: (Functor m,Monad m) => String -> m RE-compileRegex = compileRegexWithOptions ()+compileRegex = compileRegexWith minBound  -- | compile a 'String' into a 'RE' using the given @SimpleREOptions@, -- generating an error if the RE is not well formed@@ -207,7 +207,7 @@ ------------------------------------------------------------------------  -- | compile a SearchReplace template generating errors if the RE or--- the template are not well formed -- all capture references being checked+-- the template are not well formed, all capture references being checked compileSearchReplace :: (Monad m,Functor m,IsRegex RE s)                      => String                      -> String@@ -215,7 +215,7 @@ compileSearchReplace = compileSearchReplaceWith minBound  -- | compile a SearchReplace template, with simple options, generating--- errors if the RE or the template are not well formed -- all capture+-- errors if the RE or the template are not well formed, all capture -- references being checked compileSearchReplaceWith :: (Monad m,Functor m,IsRegex RE s)                          => SimpleREOptions@@ -225,7 +225,7 @@ compileSearchReplaceWith sro = compileSearchAndReplace_ packR $ compileRegexWith sro  -- | compile a SearchReplace template, with general options, generating--- errors if the RE or the template are not well formed -- all capture+-- errors if the RE or the template are not well formed, all capture -- references being checked compileSearchReplaceWithREOptions :: (Monad m,Functor m,IsRegex RE s)                                   => REOptions@@ -241,16 +241,17 @@  -- | convert a string into a RE that matches that string, and apply it -- to an argument continuation function to make up the RE string to be--- compiled+-- compiled; e.g., to compile a RE that will only match the string:+--+--  @maybe undefined id . escape ((\"^\"++) . (++\"$\"))@+-- escape :: (Functor m,Monad m)        => (String->String)        -> String        -> m RE escape = escapeWith minBound --- | convert a string into a RE that matches that string, and apply it--- to an argument continuation function to make up the RE string to be--- compiled with the default options+-- | a variant of 'escape' where the 'SimpleREOptions' are specified escapeWith :: (Functor m,Monad m)            => SimpleREOptions            -> (String->String)@@ -258,12 +259,11 @@            -> m RE escapeWith = escapeWithOptions --- | convert a string into a RE that matches that string, and apply it--- to an argument continuation function to make up the RE string to be--- compiled the given options+-- | a variant of 'escapeWith' that allows an 'IsOption' RE option+-- to be specified escapeWithOptions :: ( IsOption o RE CompOption ExecOption                      , Functor m-                     , Monad m+                     , Monad   m                      )                   => o                   -> (String->String)
− Text/RE/ZeInternals/QQ.hs
@@ -1,29 +0,0 @@-{-# LANGUAGE DeriveDataTypeable         #-}--module Text.RE.ZeInternals.QQ where--import           Control.Exception-import           Data.Typeable-import           Language.Haskell.TH.Quote----- | used to throw an exception reporting an abuse of a quasi quoter-data QQFailure =-  QQFailure-    { _qqf_context   :: String  -- ^ in what context was the quasi quoter used-    , _qqf_component :: String  -- ^ how was the quasi quoter being abused-    }-  deriving (Show,Typeable)--instance Exception QQFailure where---- | a quasi quoter that can be used in no context (to be extended with--- the appropriate quasi quoter parser)-qq0 :: String -> QuasiQuoter-qq0 ctx =-  QuasiQuoter-    { quoteExp  = const $ throw $ QQFailure ctx "expression"-    , quotePat  = const $ throw $ QQFailure ctx "pattern"-    , quoteType = const $ throw $ QQFailure ctx "type"-    , quoteDec  = const $ throw $ QQFailure ctx "declaration"-    }
Text/RE/ZeInternals/SearchReplace/PCRE/ByteString.hs view
@@ -7,7 +7,9 @@ #endif  module Text.RE.ZeInternals.SearchReplace.PCRE.ByteString-  ( ed+  ( -- * The ed Quasi Quoters+    -- $qq+    ed   , edMS   , edMI   , edBS@@ -28,7 +30,6 @@ import           Text.RE.ZeInternals.Types.SearchReplace  --- | the @[ed| ... /// ... |]@ quasi quoters ed   , edMS   , edMI@@ -56,3 +57,15 @@  fn_cast :: Q Exp fn_cast = [|\x -> x :: SimpleREOptions -> SearchReplace RE B.ByteString|]++-- $qq+-- The -- | the @[ed| ... \/\/\/ ... |]@ quasi quoters; for exaple,+--+--  @[ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@+--+-- represents a @SearchReplace@ that will convert a YYYY-MM-DD format date+-- into a DD\/MM\/YYYY format date.+--+-- The only difference betweem these quasi quoters is the RE options that are set:+-- see the "Text.RE.REOptions" documentation for details.+--
Text/RE/ZeInternals/SearchReplace/PCRE/ByteString/Lazy.hs view
@@ -7,7 +7,9 @@ #endif  module Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy-  ( ed+  ( -- * The ed Quasi Quoters+    -- $qq+    ed   , edMS   , edMI   , edBS@@ -28,7 +30,6 @@ import           Text.RE.ZeInternals.Types.SearchReplace  --- | the @[ed| ... /// ... |]@ quasi quoters ed   , edMS   , edMI@@ -56,3 +57,15 @@  fn_cast :: Q Exp fn_cast = [|\x -> x :: SimpleREOptions -> SearchReplace RE LBS.ByteString|]++-- $qq+-- The -- | the @[ed| ... \/\/\/ ... |]@ quasi quoters; for exaple,+--+--  @[ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@+--+-- represents a @SearchReplace@ that will convert a YYYY-MM-DD format date+-- into a DD\/MM\/YYYY format date.+--+-- The only difference betweem these quasi quoters is the RE options that are set:+-- see the "Text.RE.REOptions" documentation for details.+--
Text/RE/ZeInternals/SearchReplace/PCRE/Sequence.hs view
@@ -7,7 +7,9 @@ #endif  module Text.RE.ZeInternals.SearchReplace.PCRE.Sequence-  ( ed+  ( -- * The ed Quasi Quoters+    -- $qq+    ed   , edMS   , edMI   , edBS@@ -28,7 +30,6 @@ import           Text.RE.ZeInternals.Types.SearchReplace  --- | the @[ed| ... /// ... |]@ quasi quoters ed   , edMS   , edMI@@ -56,3 +57,15 @@  fn_cast :: Q Exp fn_cast = [|\x -> x :: SimpleREOptions -> SearchReplace RE (S.Seq Char)|]++-- $qq+-- The -- | the @[ed| ... \/\/\/ ... |]@ quasi quoters; for exaple,+--+--  @[ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@+--+-- represents a @SearchReplace@ that will convert a YYYY-MM-DD format date+-- into a DD\/MM\/YYYY format date.+--+-- The only difference betweem these quasi quoters is the RE options that are set:+-- see the "Text.RE.REOptions" documentation for details.+--
Text/RE/ZeInternals/SearchReplace/PCRE/String.hs view
@@ -7,7 +7,9 @@ #endif  module Text.RE.ZeInternals.SearchReplace.PCRE.String-  ( ed+  ( -- * The ed Quasi Quoters+    -- $qq+    ed   , edMS   , edMI   , edBS@@ -28,7 +30,6 @@ import           Text.RE.ZeInternals.Types.SearchReplace  --- | the @[ed| ... /// ... |]@ quasi quoters ed   , edMS   , edMI@@ -56,3 +57,15 @@  fn_cast :: Q Exp fn_cast = [|\x -> x :: SimpleREOptions -> SearchReplace RE String|]++-- $qq+-- The -- | the @[ed| ... \/\/\/ ... |]@ quasi quoters; for exaple,+--+--  @[ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@+--+-- represents a @SearchReplace@ that will convert a YYYY-MM-DD format date+-- into a DD\/MM\/YYYY format date.+--+-- The only difference betweem these quasi quoters is the RE options that are set:+-- see the "Text.RE.REOptions" documentation for details.+--
changelog view
@@ -1,5 +1,8 @@ -*-change-log-*- +0.11.1.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-03-30+  * Cannot hide Text.RE.ZeInternals.SearchReaplace modules (#101)+ 0.11.0.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-03-29   * Simplify API (#97)   * Rename Location to RELocation (#98)
regex-with-pcre.cabal view
@@ -1,12 +1,13 @@ Name:                   regex-with-pcre-Version:                0.11.0.0+Version:                0.11.1.0 Synopsis:               Toolkit for regex-base-Description:            A Regular Expression Toolkit for regex-base with-                        Compile-time checking of RE syntax, data types for+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.+                        macros with parsers and test bench, omprehensive+                        documentation, tutorials and copious examples. Homepage:               http://regex.uk Author:                 Chris Dornan License:                BSD3@@ -15,7 +16,7 @@ Copyright:              Chris Dornan 2016-2017 Category:               Text Build-type:             Simple-Stability:              RFC+Stability:              Stable bug-reports:            http://issues.regex.uk  Extra-Source-Files:@@ -31,7 +32,7 @@ Source-Repository this     Type:               git     Location:           https://github.com/iconnect/regex.git-    Tag:                0.11.0.0+    Tag:                0.11.1.0   @@ -42,12 +43,9 @@       Text.RE.PCRE       Text.RE.PCRE.ByteString       Text.RE.PCRE.ByteString.Lazy-      Text.RE.ZeInternals.PCRE       Text.RE.PCRE.Sequence       Text.RE.PCRE.String--    Other-Modules:-      Text.RE.ZeInternals.QQ+      Text.RE.ZeInternals.PCRE       Text.RE.ZeInternals.SearchReplace       Text.RE.ZeInternals.SearchReplace.PCRE       Text.RE.ZeInternals.SearchReplace.PCRE.ByteString@@ -89,7 +87,7 @@       -Wwarn      Build-depends:-        regex                == 0.11.0.0+        regex                == 0.11.1.0       , base                 >= 4 && < 5       , base-compat          >= 0.6.0       , bytestring           >= 0.10.2.0