regex 0.11.0.0 → 0.11.1.0
raw patch · 22 files changed
+568/−147 lines, 22 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Text.RE.TDFA: ed :: QuasiQuoter
- Text.RE.TDFA: edBI :: QuasiQuoter
- Text.RE.TDFA: edBS :: QuasiQuoter
- Text.RE.TDFA: edBlockInsensitive :: QuasiQuoter
- Text.RE.TDFA: edBlockSensitive :: QuasiQuoter
- Text.RE.TDFA: edMI :: QuasiQuoter
- Text.RE.TDFA: edMS :: QuasiQuoter
- Text.RE.TDFA: edMultilineInsensitive :: QuasiQuoter
- Text.RE.TDFA: edMultilineSensitive :: QuasiQuoter
- Text.RE.TDFA: ed_ :: QuasiQuoter
- Text.RE.TDFA.ByteString: ed :: QuasiQuoter
- Text.RE.TDFA.ByteString: edBI :: QuasiQuoter
- Text.RE.TDFA.ByteString: edBS :: QuasiQuoter
- Text.RE.TDFA.ByteString: edBlockInsensitive :: QuasiQuoter
- Text.RE.TDFA.ByteString: edBlockSensitive :: QuasiQuoter
- Text.RE.TDFA.ByteString: edMI :: QuasiQuoter
- Text.RE.TDFA.ByteString: edMS :: QuasiQuoter
- Text.RE.TDFA.ByteString: edMultilineInsensitive :: QuasiQuoter
- Text.RE.TDFA.ByteString: edMultilineSensitive :: QuasiQuoter
- Text.RE.TDFA.ByteString: ed_ :: QuasiQuoter
- Text.RE.TDFA.ByteString.Lazy: ed :: QuasiQuoter
- Text.RE.TDFA.ByteString.Lazy: edBI :: QuasiQuoter
- Text.RE.TDFA.ByteString.Lazy: edBS :: QuasiQuoter
- Text.RE.TDFA.ByteString.Lazy: edBlockInsensitive :: QuasiQuoter
- Text.RE.TDFA.ByteString.Lazy: edBlockSensitive :: QuasiQuoter
- Text.RE.TDFA.ByteString.Lazy: edMI :: QuasiQuoter
- Text.RE.TDFA.ByteString.Lazy: edMS :: QuasiQuoter
- Text.RE.TDFA.ByteString.Lazy: edMultilineInsensitive :: QuasiQuoter
- Text.RE.TDFA.ByteString.Lazy: edMultilineSensitive :: QuasiQuoter
- Text.RE.TDFA.ByteString.Lazy: ed_ :: QuasiQuoter
- Text.RE.TDFA.Sequence: ed :: QuasiQuoter
- Text.RE.TDFA.Sequence: edBI :: QuasiQuoter
- Text.RE.TDFA.Sequence: edBS :: QuasiQuoter
- Text.RE.TDFA.Sequence: edBlockInsensitive :: QuasiQuoter
- Text.RE.TDFA.Sequence: edBlockSensitive :: QuasiQuoter
- Text.RE.TDFA.Sequence: edMI :: QuasiQuoter
- Text.RE.TDFA.Sequence: edMS :: QuasiQuoter
- Text.RE.TDFA.Sequence: edMultilineInsensitive :: QuasiQuoter
- Text.RE.TDFA.Sequence: edMultilineSensitive :: QuasiQuoter
- Text.RE.TDFA.Sequence: ed_ :: QuasiQuoter
- Text.RE.TDFA.String: ed :: QuasiQuoter
- Text.RE.TDFA.String: edBI :: QuasiQuoter
- Text.RE.TDFA.String: edBS :: QuasiQuoter
- Text.RE.TDFA.String: edBlockInsensitive :: QuasiQuoter
- Text.RE.TDFA.String: edBlockSensitive :: QuasiQuoter
- Text.RE.TDFA.String: edMI :: QuasiQuoter
- Text.RE.TDFA.String: edMS :: QuasiQuoter
- Text.RE.TDFA.String: edMultilineInsensitive :: QuasiQuoter
- Text.RE.TDFA.String: edMultilineSensitive :: QuasiQuoter
- Text.RE.TDFA.String: ed_ :: QuasiQuoter
- Text.RE.TDFA.Text: ed :: QuasiQuoter
- Text.RE.TDFA.Text: edBI :: QuasiQuoter
- Text.RE.TDFA.Text: edBS :: QuasiQuoter
- Text.RE.TDFA.Text: edBlockInsensitive :: QuasiQuoter
- Text.RE.TDFA.Text: edBlockSensitive :: QuasiQuoter
- Text.RE.TDFA.Text: edMI :: QuasiQuoter
- Text.RE.TDFA.Text: edMS :: QuasiQuoter
- Text.RE.TDFA.Text: edMultilineInsensitive :: QuasiQuoter
- Text.RE.TDFA.Text: edMultilineSensitive :: QuasiQuoter
- Text.RE.TDFA.Text: ed_ :: QuasiQuoter
- Text.RE.TDFA.Text.Lazy: ed :: QuasiQuoter
- Text.RE.TDFA.Text.Lazy: edBI :: QuasiQuoter
- Text.RE.TDFA.Text.Lazy: edBS :: QuasiQuoter
- Text.RE.TDFA.Text.Lazy: edBlockInsensitive :: QuasiQuoter
- Text.RE.TDFA.Text.Lazy: edBlockSensitive :: QuasiQuoter
- Text.RE.TDFA.Text.Lazy: edMI :: QuasiQuoter
- Text.RE.TDFA.Text.Lazy: edMS :: QuasiQuoter
- Text.RE.TDFA.Text.Lazy: edMultilineInsensitive :: QuasiQuoter
- Text.RE.TDFA.Text.Lazy: edMultilineSensitive :: QuasiQuoter
- Text.RE.TDFA.Text.Lazy: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.QQ: QQFailure :: String -> String -> QQFailure
+ Text.RE.ZeInternals.QQ: [_qqf_component] :: QQFailure -> String
+ Text.RE.ZeInternals.QQ: [_qqf_context] :: QQFailure -> String
+ Text.RE.ZeInternals.QQ: data QQFailure
+ Text.RE.ZeInternals.QQ: instance GHC.Exception.Exception Text.RE.ZeInternals.QQ.QQFailure
+ Text.RE.ZeInternals.QQ: instance GHC.Show.Show Text.RE.ZeInternals.QQ.QQFailure
+ Text.RE.ZeInternals.QQ: qq0 :: String -> 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.TDFA: ed :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA: edBI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA: edBS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA: edBlockInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA: edBlockSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA: edMI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA: edMS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA: edMultilineInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA: edMultilineSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString: ed :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString: edBI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString: edBS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString: edBlockInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString: edBlockSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString: edMI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString: edMS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString: edMultilineInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString: edMultilineSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy: ed :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy: edBI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy: edBS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy: edBlockInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy: edBlockSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy: edMI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy: edMS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy: edMultilineInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy: edMultilineSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Sequence: ed :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Sequence: edBI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Sequence: edBS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Sequence: edBlockInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Sequence: edBlockSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Sequence: edMI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Sequence: edMS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Sequence: edMultilineInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Sequence: edMultilineSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Sequence: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.String: ed :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.String: edBI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.String: edBS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.String: edBlockInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.String: edBlockSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.String: edMI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.String: edMS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.String: edMultilineInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.String: edMultilineSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.String: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text: ed :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text: edBI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text: edBS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text: edBlockInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text: edBlockSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text: edMI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text: edMS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text: edMultilineInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text: edMultilineSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy: ed :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy: edBI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy: edBS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy: edBlockInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy: edBlockSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy: edMI :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy: edMS :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy: edMultilineInsensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy: edMultilineSensitive :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy: ed_ :: QuasiQuoter
+ Text.RE.ZeInternals.SearchReplace.TDFAEdPrime: ed' :: Q Exp -> Maybe SimpleREOptions -> QuasiQuoter
- Text.RE.ZeInternals.TestBench: dumpMacroTable :: String -> RegexType -> MacroEnv -> IO ()
+ Text.RE.ZeInternals.TestBench: dumpMacroTable :: FilePath -> FilePath -> RegexType -> MacroEnv -> IO ()
Files
- Text/RE.hs +21/−8
- Text/RE/REOptions.lhs +20/−8
- Text/RE/Summa.hs +1/−1
- Text/RE/TDFA.hs +33/−13
- Text/RE/TDFA/ByteString.hs +58/−11
- Text/RE/TDFA/ByteString/Lazy.hs +58/−11
- Text/RE/TDFA/Sequence.hs +58/−11
- Text/RE/TDFA/String.hs +58/−11
- Text/RE/TDFA/Text.hs +58/−11
- Text/RE/TDFA/Text/Lazy.hs +58/−11
- Text/RE/ZeInternals.hs +15/−0
- Text/RE/ZeInternals/EscapeREString.hs +1/−1
- Text/RE/ZeInternals/SearchReplace/TDFA/ByteString.hs +15/−2
- Text/RE/ZeInternals/SearchReplace/TDFA/ByteString/Lazy.hs +15/−2
- Text/RE/ZeInternals/SearchReplace/TDFA/Sequence.hs +15/−2
- Text/RE/ZeInternals/SearchReplace/TDFA/String.hs +15/−2
- Text/RE/ZeInternals/SearchReplace/TDFA/Text.hs +15/−2
- Text/RE/ZeInternals/SearchReplace/TDFA/Text/Lazy.hs +15/−2
- Text/RE/ZeInternals/TDFA.hs +11/−11
- Text/RE/ZeInternals/TestBench.lhs +8/−10
- changelog +3/−0
- regex.cabal +17/−17
Text/RE.hs view
@@ -15,14 +15,18 @@ -- * How to use this library -- $use - -- * Matches+ -- * Further Use+ -- $further++ -- * The regex Foundational Types+ -- ** Matches Matches , matchesSource , allMatches , anyMatches , countMatches , matches- -- * Match+ -- ** Match , Match , matchSource , matched@@ -38,17 +42,17 @@ -- $use ----- This module just provides an overview of the key type on which--- the regex package is built. You will need to import one of the API--- modules of which there is a choice which will depend upon two factors:+-- This module just provides a brief overview of the regex package. You+-- will need to import one of the API modules of which there is a choice+-- which will depend upon two factors: ----- * Which flavour of regular expression do you want to use? If you want--- Posix flavour REs then you want the TDFA modules, otherwise its+-- * Which flavour of regular expression do you want to use? If you need+-- Posix flavour REs then you will want the TDFA modules, otherwise its -- PCRE for Perl-style REs. -- -- * What type of text do you want to match: (slow) @String@s, @ByteString@, -- @ByteString.Lazy@, @Text@, @Text.Lazy@ or the anachronistic @Seq Char@--- or indeed a good old-fashioned polymorphic operators?+-- or indeed some good old-fashioned polymorphic operators? -- -- While we aim to provide all combinations of these choices, some of them -- are currently not available. In the regex package we have:@@ -71,3 +75,12 @@ -- * Text.RE.PCRE.Sequence -- * Text.RE.PCRE.String -- * Text.RE.PCRE++-- $further+-- For more specialist applications we have the following:+--+-- * "Text.RE.REOptions" for specifying back-end specific options;+-- * "Text.RE.Replace" for the full replace toolkit;+-- * "Text.RE.TestBench" for building up, testing and doumenting;+-- macro environments for use in REs;+-- * "Text.RE.Tools" for an AWK-like text-processing toolkit.
Text/RE/REOptions.lhs view
@@ -12,13 +12,12 @@ module Text.RE.REOptions (- -- * SimpleREOptions+ -- * RE Options SimpleREOptions(..)- -- * REOptions_ , REOptions_(..)- -- * IsOption+ -- * The IsOption Class , IsOption(..)- -- * Macros+ -- * The Macro Tables , Macros , MacroID(..) , emptyMacros@@ -31,6 +30,10 @@ import Language.Haskell.TH.Syntax \end{code} ++The RE Options+--------------+ \begin{code} -- | the default API uses these simple, universal RE options, -- which get auto-converted into the apropriate back-end 'REOptions_'@@ -59,7 +62,7 @@ -- and its @CompOption@ and @ExecOption@ types (the compile-time and -- execution time options, respectively); each back end will define an -- @REOptions@ type that fills out these three type parameters with the--- apropriate types+-- apropriate types (see, for example, "Text.RE.ZeInternals.TDFA") data REOptions_ r c e = REOptions { optionsMacs :: !(Macros r) -- ^ the available TestBench RE macros@@ -69,18 +72,27 @@ deriving (Show) \end{code} ++The IsOption Class+------------------+ \begin{code}--- | a number of types can be used to encode @REOptions@, each of which--- can be made a member of this class.+-- | a number of types can be used to encode 'REOptions_', each of which+-- is made a member of this class class IsOption o r c e | e -> r, c -> e , e -> c, r -> c, c -> r, r -> e where -- | convert the @o@ type into an @REOptions r c e@ makeREOptions :: o -> REOptions_ r c e \end{code} ++The Macro Tables+----------------+ \begin{code} -- | our macro tables are parameterised over the backend @RE@ type and--- and just associate each @MacroID@ with an @RE@+-- and just associate each @MacroID@ with an @RE@ (which may in turn+-- contain macros to be expanded) type Macros r = HM.HashMap MacroID r \end{code}
Text/RE/Summa.hs view
@@ -16,5 +16,5 @@ -- This module collects together all of the generic regex APIs not -- exported by the back-end-specific API modules. The regex -- API is modular with only the most common types and functions being--- exported by these modules but the remining modules may be imported+-- exported by these modules but the remaining modules may be imported -- en masse by importing this module.
Text/RE/TDFA.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.TDFA- -- * The [ed| ... |] quasi quoters+ -- $ed , module Text.RE.ZeInternals.SearchReplace.TDFA -- * The Operator Instances -- $instances@@ -73,7 +78,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]+|]@ --@@ -83,17 +89,22 @@ -> 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 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}|])@ -- (*=~/) :: IsRegex RE s => s -> SearchReplace RE s -> s (*=~/) = flip searchReplaceAll@@ -126,8 +137,8 @@ -- $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--- back end. If you don't need this generality you might want to consider+-- that operate over all of the String\/Text\/ByteString types supported by the+-- back end. If you don't need this generality then you might want to consider -- using one of the modules that have been specialised for each of these types: -- -- * "Text.RE.TDFA.ByteString"@@ -137,6 +148,15 @@ -- * "Text.RE.TDFA.String" -- * "Text.RE.TDFA.Text" -- * "Text.RE.TDFA.Text.Lazy"++-- $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 --
Text/RE/TDFA/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.TDFA+ -- $ed , module Text.RE.ZeInternals.SearchReplace.TDFA.ByteString ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.TDFA as TDFA --- | 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/TDFA/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.TDFA+ -- $ed , module Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.TDFA as TDFA --- | 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/TDFA/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.TDFA+ -- $ed , module Text.RE.ZeInternals.SearchReplace.TDFA.Sequence ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.TDFA as TDFA --- | 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/TDFA/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.TDFA+ -- $ed , module Text.RE.ZeInternals.SearchReplace.TDFA.String ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.TDFA as TDFA --- | 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/TDFA/Text.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.TDFA+ -- $ed , module Text.RE.ZeInternals.SearchReplace.TDFA.Text ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.TDFA as TDFA --- | 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 T.Text (*=~) 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]+|]@+-- (?=~) :: T.Text -> RE -> Match T.Text (?=~) 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}|])@ -- (*=~/) :: T.Text -> SearchReplace RE T.Text -> T.Text (*=~/) = 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|])+-- (?=~/) :: T.Text -> SearchReplace RE T.Text -> T.Text (?=~/) = 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/TDFA/Text/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.TDFA+ -- $ed , module Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.TDFA as TDFA --- | 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 TL.Text (*=~) 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]+|]@+-- (?=~) :: TL.Text -> RE -> Match TL.Text (?=~) 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}|])@ -- (*=~/) :: TL.Text -> SearchReplace RE TL.Text -> TL.Text (*=~/) = 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|])+-- (?=~/) :: TL.Text -> SearchReplace RE TL.Text -> TL.Text (?=~/) = 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.hs view
@@ -0,0 +1,15 @@+module Text.RE.ZeInternals+ (+ -- * The regex Internal Modules+ -- $internals+ ) where++-- $internals+-- The modules under 'ZeInternals' do not belong to the /official/ regex+-- API, though their contents will so belong if they are listed in the outside+-- `Text.RE` modules. This doesn't mean that they cannot be used but be aware+-- that they may not be as stable or as well documented as the official API+-- modules.+--+-- If you do notice anything in here that you think we have missed that+-- should be listed in the official API then please drop us a line.
Text/RE/ZeInternals/EscapeREString.hs view
@@ -1,6 +1,6 @@ module Text.RE.ZeInternals.EscapeREString where --- | Convert a string into a regular expression that will amtch that+-- | Convert a string into a regular expression that will match that -- string escapeREString :: String -> String escapeREString = foldr esc []
Text/RE/ZeInternals/SearchReplace/TDFA/ByteString.hs view
@@ -7,7 +7,9 @@ #endif module Text.RE.ZeInternals.SearchReplace.TDFA.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/TDFA/ByteString/Lazy.hs view
@@ -7,7 +7,9 @@ #endif module Text.RE.ZeInternals.SearchReplace.TDFA.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/TDFA/Sequence.hs view
@@ -7,7 +7,9 @@ #endif module Text.RE.ZeInternals.SearchReplace.TDFA.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/TDFA/String.hs view
@@ -7,7 +7,9 @@ #endif module Text.RE.ZeInternals.SearchReplace.TDFA.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.+--
Text/RE/ZeInternals/SearchReplace/TDFA/Text.hs view
@@ -7,7 +7,9 @@ #endif module Text.RE.ZeInternals.SearchReplace.TDFA.Text- ( 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 T.Text|]++-- $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/TDFA/Text/Lazy.hs view
@@ -7,7 +7,9 @@ #endif module Text.RE.ZeInternals.SearchReplace.TDFA.Text.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 TL.Text|]++-- $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/TDFA.hs view
@@ -179,7 +179,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@@ -203,7 +203,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@@ -211,7 +211,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@@ -221,7 +221,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@@ -237,16 +237,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)@@ -254,9 +255,8 @@ -> 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
Text/RE/ZeInternals/TestBench.lhs view
@@ -37,7 +37,6 @@ ) where import Data.Array-import Data.Char import qualified Data.HashMap.Lazy as HML import qualified Data.List as L import Data.Maybe@@ -234,15 +233,14 @@ \begin{code} -- | dump a MacroEnv into the docs directory-dumpMacroTable :: String -> RegexType -> MacroEnv -> IO ()-dumpMacroTable lab rty m_env = do- writeFile fp_t $ formatMacroTable rty m_env- writeFile fp_s $ formatMacroSources rty ExclCaptures m_env- where- fp_t = "docs/" ++ rty_s ++ "-" ++ lab ++ ".txt"- fp_s = "docs/" ++ rty_s ++ "-" ++ lab ++ "-src.txt"-- rty_s = map toLower $ presentRegexType rty+dumpMacroTable :: FilePath+ -> FilePath+ -> RegexType+ -> MacroEnv+ -> IO ()+dumpMacroTable fp_t fp_s rty m_env = do+ writeFile fp_t $ formatMacroTable rty m_env+ writeFile fp_s $ formatMacroSources rty ExclCaptures m_env \end{code} \begin{code}
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.cabal view
@@ -1,12 +1,13 @@ Name: regex-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,6 +43,7 @@ Exposed-Modules: Text.RE Text.RE.IsRegex+ Text.RE.REOptions Text.RE.Replace Text.RE.Summa Text.RE.TDFA@@ -57,23 +59,14 @@ Text.RE.Tools.Grep Text.RE.Tools.Lex Text.RE.Tools.Sed+ Text.RE.ZeInternals Text.RE.ZeInternals.AddCaptureNames Text.RE.ZeInternals.EscapeREString Text.RE.ZeInternals.NamedCaptures Text.RE.ZeInternals.PreludeMacros+ Text.RE.ZeInternals.QQ Text.RE.ZeInternals.Replace- Text.RE.ZeInternals.TDFA- Text.RE.ZeInternals.TestBench- Text.RE.ZeInternals.Types.Capture- Text.RE.ZeInternals.Types.CaptureID- Text.RE.ZeInternals.Types.LineNo- Text.RE.ZeInternals.Types.Match- Text.RE.ZeInternals.Types.Matches- Text.RE.REOptions Text.RE.ZeInternals.Types.SearchReplace-- Other-Modules:- Text.RE.ZeInternals.QQ Text.RE.ZeInternals.SearchReplace Text.RE.ZeInternals.SearchReplace.TDFA Text.RE.ZeInternals.SearchReplace.TDFA.ByteString@@ -83,6 +76,13 @@ Text.RE.ZeInternals.SearchReplace.TDFA.Text Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy Text.RE.ZeInternals.SearchReplace.TDFAEdPrime+ Text.RE.ZeInternals.TDFA+ Text.RE.ZeInternals.TestBench+ Text.RE.ZeInternals.Types.Capture+ Text.RE.ZeInternals.Types.CaptureID+ Text.RE.ZeInternals.Types.LineNo+ Text.RE.ZeInternals.Types.Match+ Text.RE.ZeInternals.Types.Matches Default-Language: Haskell2010