You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/usage.md
+9-8
Original file line number
Diff line number
Diff line change
@@ -89,7 +89,7 @@ duration.toPattern
89
89
90
90
### random matches for a regular expression
91
91
92
-
Irrec provides support for creating [Scalacheck](https://www.scalacheck.org/) generators that produce values that match a regular expression. This generation is done efficiently as opposed to generating a bunch of random values and then filtering the ones that don't match the regular expression (which would quickly lead to Scalacheck giving up on generating matching values).
92
+
Irrec provides [Scalacheck](https://www.scalacheck.org/) generators that produce values that match a regular expression. These can be useful for tests, or even just for glancing at random matches to ensure that your regular expression does what you intended. Check out the [regex-explorer](regex-explorer.md) for interactive browser-based regular expression exploration powered by irrec.
93
93
94
94
```scala mdoc:silent
95
95
importceedubs.irrec.regex.gen._, CharRegexGen._
@@ -103,20 +103,24 @@ val genDurationString: Gen[String] = genRegexMatchingString(duration)
Were all of those results input that you intended your regular expression to accept?
107
+
108
+
This generation is done efficiently as opposed to generating a bunch of random values and then filtering the ones that don't match the regular expression (which would quickly lead to Scalacheck giving up on generating matching values).
109
+
106
110
Sometimes you may want to generate both matches and non-matches for your regular expression to make sure that both cases are handled. There are various `Gen` instances that will generate input that matches the regular expresssion roughly half of the time.
Sometimes you may want to generate both matches and non-matches for your random regular expression to make sure that both cases are handled. There are various `Gen` instances for `RegexAndCandidate` that will generate random regular expressions along with data that matches the regular expresssion roughly half of the time.
0 commit comments