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/content/2.getting-started/2.usage.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,23 +35,23 @@ By default, all helpers from `magic-regexp` assume that input that is passed sho
35
35
36
36
There are a range of helpers that can be used to activate pattern matching, and they can be chained. Each one of these returns an object of type `Input` that can be passed directly to `new RegExp`, `createRegExp`, to another helper or chained to produce more complex patterns.
|`charIn`, `charNotIn`| this matches or doesn't match any character in the string provided. |
41
-
|`anyOf`| this takes an array of inputs and matches any of them. |
42
-
|`char`, `word`, `wordBoundary`, `digit`, `whitespace`, `letter`, `tab`, `linefeed` and `carriageReturn`| these are helpers for specific RegExp characters. |
43
-
|`not`| this can prefix `word`, `wordBoundary`, `digit`, `whitespace`, `letter`, `tab`, `linefeed` or `carriageReturn`. For example `createRegExp(not.letter)`. |
44
-
|`maybe`| equivalent to `?` - this marks the input as optional. |
45
-
|`oneOrMore`| Equivalent to `+` - this marks the input as repeatable, any number of times but at least once. |
46
-
|`exactly`| This escapes a string input to match it exactly. |
|`charIn`, `charNotIn`| this matches or doesn't match any character in the string provided.|
41
+
|`anyOf`| this takes an array of inputs and matches any of them.|
42
+
|`char`, `word`, `wordChar`, `wordBoundary`, `digit`, `whitespace`, `letter`, `tab`, `linefeed` and `carriageReturn`| these are helpers for specific RegExp characters.|
43
+
|`not`| this can prefix `word`, `wordChar`, `wordBoundary`, `digit`, `whitespace`, `letter`, `tab`, `linefeed` or `carriageReturn`. For example `createRegExp(not.letter)`. |
44
+
|`maybe`| equivalent to `?` - this marks the input as optional.|
45
+
|`oneOrMore`| Equivalent to `+` - this marks the input as repeatable, any number of times but at least once.|
46
+
|`exactly`| This escapes a string input to match it exactly.|
47
47
48
48
## Chaining inputs
49
49
50
50
All of the helpers above return an object of type `Input` that can be chained with the following helpers:
|`and`| this adds a new pattern to the current input, or you can use `and.referenceTo(groupName)` to adds a new pattern referencing to a named group. |
54
+
|`and`| this adds a new pattern to the current input, or you can use `and.referenceTo(groupName)` to adds a new pattern referencing to a named group. |
55
55
|`or`| this provides an alternative to the current input. |
56
56
|`after`, `before`, `notAfter` and `notBefore`| these activate positive/negative lookahead/lookbehinds. Make sure to check [browser support](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#browser_compatibility) as not all browsers support lookbehinds (notably Safari). |
57
57
|`times`| this is a function you can call directly to repeat the previous pattern an exact number of times, or you can use `times.between(min, max)` to specify a range, `times.atLeast(num)` to indicate it must repeat x times or `times.any()` to indicate it can repeat any number of times, _including none_. |
0 commit comments