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
+20-10Lines changed: 20 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,31 +5,41 @@
5
5
6
6
### Installation
7
7
8
-
You can download the [latest release as a PHAR](https://github.com/s9e/RegexpBuilderCommand/releases/latest/download/build-regexp.phar), or install the command as a [Composer](https://getcomposer.org/download/) dependency:
8
+
There are two ways to use this command. You can download the [latest release as a PHAR](https://github.com/s9e/RegexpBuilderCommand/releases/latest/download/build-regexp.phar):
Or you can install the command as a [Composer](https://getcomposer.org/download/) dependency:
17
+
18
+
```
19
+
$ composer -q require s9e/regexp-builder-command
20
+
$ vendor/bin/build-regexp --version
21
+
build-regexp 0.4.3
12
22
```
13
23
14
24
15
25
### Usage
16
26
17
27
Strings can be specified either directly in the command invocation or via an input file. The following shell example shows how to pass them in the command invocation as a space-separated list:
18
28
```
19
-
$ ./vendor/bin/build-regexp foo bar baz
29
+
$ ./build-regexp.phar foo bar baz
20
30
(?:ba[rz]|foo)
21
31
```
22
32
23
33
In the following example, we create a file with each value on its own line, then we pass the name of the file via the `infile` option:
24
34
```
25
35
$ echo -e "one\ntwo\nthree" > strings.txt
26
-
$ ./vendor/bin/build-regexp --infile strings.txt
36
+
$ ./build-regexp.phar --infile strings.txt
27
37
(?:one|t(?:hree|wo))
28
38
```
29
39
30
40
By default, the result is output in the terminal directly. Alternatively, it can be saved to a file specified via the `outfile` option. In the following example, we save the result to a `out.txt` file before checking its content:
31
41
```
32
-
$ ./vendor/bin/build-regexp --outfile out.txt foo bar baz
42
+
$ ./build-regexp.phar --outfile out.txt foo bar baz
33
43
$ cat out.txt
34
44
(?:ba[rz]|foo)
35
45
```
@@ -46,16 +56,16 @@ Several presets are available to generate regexps for different engines. They de
46
56
47
57
The following examples show the results of a few different presets with the Unicode characters U+1F601 and U+1F602 as input.
0 commit comments