@@ -27,7 +27,7 @@
2727-- * @\"foo\/*.html\"@ will match all HTML files in the @\"foo\/\"@ directory.
2828--
2929-- The 'capture' function allows the user to get access to the elements captured
30−-- by the capture elements in the pattern.
30+-- by the capture elements in a glob or regex pattern.
3131module Hakyll.Core.Identifier.Pattern
3232 ( -- * The pattern type
3333 Pattern
@@ -260,9 +260,11 @@ splits = inits &&& tails >>> uncurry zip >>> reverse
260260
261261
262262--------------------------------------------------------------------------------
263−-- | Match a glob against a pattern, generating a list of captures
263+-- | Match a glob or regex pattern against an identifier, generating a list of captures
264264capture :: Pattern -> Identifier -> Maybe [String]
265265capture (Glob p) i = capture' p (toFilePath i)
266+capture (Regex pat) i = Just groups
267+ where (_, _, _, groups) = ((toFilePath i) =~ pat) :: (String, String, String, [String])
266268capture _ _ = Nothing
267269
268270