File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -225,12 +225,18 @@ unCodePoint = unsafeCoerce
225225-- | at the current parser position. On success, it will return the matched
226226-- | substring.
227227-- |
228+ -- | If the `Regex` pattern string fails to compile then this parser will fail.
229+ -- | (Note: It’s not possible to use a precompiled `Regex` because this parser
230+ -- | must set flags and make adjustments to the `Regex` pattern string.)
231+ -- |
228232-- | This parser may be useful for quickly consuming a large section of the
229233-- | input `String`, because in a JavaScript runtime environment the `RegExp`
230234-- | runtime is a lot faster than primitive parsers.
231235-- |
232236-- | [*MDN Regular Expressions Cheatsheet*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet)
233237-- |
238+ -- | #### Flags
239+ -- |
234240-- | The `Record flags` argument to the parser is for `Regex` flags. Here are
235241-- | the default flags.
236242-- |
@@ -249,10 +255,6 @@ unCodePoint = unsafeCoerce
249255-- | and use of the other flags may cause strange behavior in the parser.
250256-- |
251257-- | [*MDN Advanced searching with flags*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#advanced_searching_with_flags)
252- -- |
253- -- | If the `Regex` pattern string fails to compile then this parser will fail.
254- -- | (Note: It’s not possible to use a precompiled `Regex` because this parser
255- -- | must set flags and make adjustments to the `Regex` pattern string.)
256258regex
257259 :: forall m flags f_
258260 . Monad m
Original file line number Diff line number Diff line change @@ -688,6 +688,8 @@ main = do
688688 parseTest " regexregex" " regexregex" (regex {} " (regex)*" )
689689 parseTest " regexregex" " regex" (regex {} " (^regex)*" )
690690 parseTest " ReGeX" " ReGeX" (regex { ignoreCase: true } " regex" )
691+ parseTest " regexcapregexcap" " regexcap" (regex {} " (?<CaptureGroupName>regexcap)" )
692+ parseTest " regexcapregexcap" " regexcap" (regex {} " (((?<CaptureGroupName>(r)e(g)excap)))" )
691693
692694 -- Maybe it is nonsense to allow multiline regex.
693695 -- Because an end-of-line regex pattern `$` will match but then the
You can’t perform that action at this time.
0 commit comments