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: README.md
+13-9Lines changed: 13 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,9 @@ A user-friendly regular expression builder for TypeScript and JavaScript.
6
6
7
7
## Goal
8
8
9
-
Regular expressions are a powerful tool for matching simple and complex text patterns, yet they are notorious for their hard-to-parse syntax.
9
+
Regular expressions are a powerful tool for matching text patterns, yet they are notorious for their hard-to-parse syntax, especially in the case of more complex patterns.
10
10
11
-
This library allows users to create regular expressions in a structured way, making them ease to understand.
11
+
This library allows users to create regular expressions in a structured way, making them easy to write and review. It provides a domain-specific langauge for defining regular expressions, which are finally turned into JavaScript-native `RegExp` objects for fast execution.
12
12
13
13
```ts
14
14
// Before
@@ -61,8 +61,8 @@ TS Regex Builder allows you to build complex regular expressions using domain-sp
61
61
62
62
Terminology:
63
63
- regex construct (`RegexConstruct`) - common name for all regex constructs like character classes, quantifiers, and anchors.
64
-
- regex element (`RegexElement`) - fundamental building block of a regular expression, defined as either a regex construct or a string.
65
-
- regex sequence (`RegexSequence`) - a sequence of regex elements forming a regular expression. For developer convenience it also accepts a single element instead of array.
64
+
- regex element (`RegexElement`) - a fundamental building block of a regular expression, defined as either a regex construct or a string.
65
+
- regex sequence (`RegexSequence`) - a sequence of regex elements forming a regular expression. For developer convenience, it also accepts a single element instead of an array.
66
66
67
67
Most of the regex constructs accept a regex sequence as their argument.
|`startOfString`|`^`| Match the start of the string (or the start of a line in multiline mode) |
135
+
|`endOfString`|`$`| Match the end of the string (or the end of a line in multiline mode) |
136
136
137
137
## Examples
138
138
139
139
See [Examples document](./docs/Examples.md).
140
140
141
+
## Performance
142
+
143
+
Regular expressions created with this library are executed at runtime, so you should avoid creating them in a context where they would need to be executed multiple times, e.g., inside loops or functions. We recommend that you create a top-level object for each required regex.
144
+
141
145
## Contributing
142
146
143
147
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
Copy file name to clipboardExpand all lines: docs/API.md
+17-17Lines changed: 17 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
### `RegexSequence`
6
6
7
-
The sequence of regex elements forming a regular expression. For developer convenience it also accepts a single element instead of array.
7
+
The sequence of regex elements forming a regular expression. For developer convenience, it also accepts a single element instead of an array.
8
8
9
9
### `RegexElement`
10
10
@@ -14,7 +14,7 @@ Fundamental building blocks of a regular expression, defined as either a regex c
14
14
15
15
The common type for all regex constructs like character classes, quantifiers, and anchors. You should not need to use this type directly, it is returned by all regex construct functions.
16
16
17
-
Note: the shape of the `RegexConstruct` is considered private, and may change in a breaking way without a major release. We will focus on maintaining the compatibility of regexes built with
17
+
Note: the shape of the `RegexConstruct` is considered private and may change in a breaking way without a major release. We will focus on maintaining the compatibility of regexes built with
18
18
19
19
20
20
## Builder
@@ -33,14 +33,14 @@ function buildRegExp(
33
33
):RegExp;
34
34
```
35
35
36
-
The `buildRegExp` is a top-level function responsible for build JavaScript-native `RegExp` object from passed regex sequence.
36
+
The `buildRegExp` is a top-level function responsible for building a JavaScript-native `RegExp` object from passed regex sequence.
37
37
38
38
It optionally accepts a list of regex flags:
39
39
40
-
-`global` - find all matches in a string, instead of just the first one.
40
+
-`global` - find all matches in a string instead of just the first one.
0 commit comments