Skip to content

Commit 1e63795

Browse files
author
Alexandre van Beurden
committed
Update README.md
1 parent 57faf85 commit 1e63795

File tree

1 file changed

+182
-2
lines changed

1 file changed

+182
-2
lines changed

README.md

Lines changed: 182 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RegexSolver Java API Client
2+
23
[Homepage](https://regexsolver.com) | [Documentation](https://docs.regexsolver.com) | [Developer Console](https://console.regexsolver.com)
34

45
This repository contains the source code of the Java library for [RegexSolver](https://regexsolver.com) API.
@@ -15,6 +16,7 @@ they were sets.
1516
### Maven
1617

1718
```xml
19+
1820
<dependency>
1921
<groupId>com.regexsolver.api</groupId>
2022
<artifactId>RegexSolver</artifactId>
@@ -30,7 +32,8 @@ implementation "com.regexsolver.api:RegexSolver:1.0.2"
3032

3133
## Usage
3234

33-
In order to use the library you need to generate an API Token on our [Developer Console](https://console.regexsolver.com/).
35+
In order to use the library you need to generate an API Token on
36+
our [Developer Console](https://console.regexsolver.com/).
3437

3538
```java
3639
import com.regexsolver.api.RegexSolver;
@@ -41,7 +44,7 @@ import java.io.IOException;
4144

4245
public class Main {
4346
public static void main(String[] args) throws IOException, ApiError {
44-
RegexSolver.initialize(/* Your API token here -> */"");
47+
RegexSolver.initialize("YOUR TOKEN HERE");
4548

4649
Term term1 = Term.regex("(abc|de|fg){2,}");
4750
Term term2 = Term.regex("de.*");
@@ -56,3 +59,180 @@ public class Main {
5659
}
5760
}
5861
```
62+
63+
## Features
64+
65+
- [Intersection](#intersection)
66+
- [Union](#union)
67+
- [Subtraction / Difference](#subtraction--difference)
68+
- [Equivalence](#equivalence)
69+
- [Subset](#subset)
70+
- [Details](#details)
71+
- [Generate Strings](#generate-strings)
72+
73+
### Intersection
74+
75+
#### Request
76+
77+
Compute the intersection of the provided terms and return the resulting term.
78+
79+
The maximum number of terms is currently limited to 10.
80+
81+
```java
82+
Term.Regex term1 = Term.regex("(abc|de){2}");
83+
Term.Regex term2 = Term.regex("de.*");
84+
Term.Regex term3 = Term.regex(".*abc");
85+
86+
Term result = term1.intersection(term2, term3);
87+
System.out.
88+
89+
println(result);
90+
```
91+
92+
#### Response
93+
94+
```
95+
regex=deabc
96+
```
97+
98+
### Union
99+
100+
Compute the union of the provided terms and return the resulting term.
101+
102+
The maximum number of terms is currently limited to 10.
103+
104+
#### Request
105+
106+
```java
107+
Term.Regex term1 = Term.regex("abc");
108+
Term.Regex term2 = Term.regex("de");
109+
Term.Regex term3 = Term.regex("fghi");
110+
111+
Term result = term1.union(term2, term3);
112+
System.out.
113+
114+
println(result);
115+
```
116+
117+
#### Response
118+
119+
```
120+
regex=(abc|de|fghi)
121+
```
122+
123+
### Subtraction / Difference
124+
125+
Compute the first term minus the second and return the resulting term.
126+
127+
#### Request
128+
129+
```java
130+
Term.Regex term1 = Term.regex("(abc|de)");
131+
Term.Regex term2 = Term.regex("de");
132+
133+
Term result = term1.subtraction(term2);
134+
System.out.
135+
136+
println(result);
137+
```
138+
139+
#### Response
140+
141+
```
142+
regex=abc
143+
```
144+
145+
### Equivalence
146+
147+
Analyze if the two provided terms are equivalent.
148+
149+
#### Request
150+
151+
```java
152+
Term.Regex term1 = Term.regex("(abc|de)");
153+
Term.Fair term2 = Term.regex("(abc|de)*");
154+
155+
boolean result = term1.isEquivalentTo(term2);
156+
System.out.
157+
158+
println(result);
159+
```
160+
161+
#### Response
162+
163+
```
164+
false
165+
```
166+
167+
### Subset
168+
169+
Analyze if the second term is a subset of the first.
170+
171+
#### Request
172+
173+
```java
174+
Term.Regex term1 = Term.regex("de");
175+
Term.Regex term2 = Term.regex("(abc|de)");
176+
177+
boolean result = term1.isSubsetOf(term2);
178+
System.out.
179+
180+
println(result);
181+
```
182+
183+
#### Response
184+
185+
```
186+
true
187+
```
188+
189+
### Details
190+
191+
Compute the details of the provided term.
192+
193+
The computed details are:
194+
195+
- **Cardinality:** the number of possible values.
196+
- **Length:** the minimum and maximum length of possible values.
197+
- **Empty:** true if is an empty set (does not contain any value), false otherwise.
198+
- **Total:** true if is a total set (contains all values), false otherwise.
199+
200+
#### Request
201+
202+
```java
203+
Term.Regex term = Term.regex("(abc|de)");
204+
205+
Details details = term.getDetails();
206+
System.out.
207+
208+
println(details);
209+
```
210+
211+
#### Response
212+
213+
```
214+
Details[cardinality=Integer(2), length=Length[minimum=2, maximum=3], empty=false, total=false]
215+
```
216+
217+
### Generate Strings
218+
219+
Generate the given number of strings that can be matched by the provided term.
220+
221+
The maximum number of strings to generate is currently limited to 200.
222+
223+
#### Request
224+
225+
```java
226+
Term.Regex term = Term.regex("(abc|de){2}");
227+
228+
List<String> strings = term.generateStrings(3);
229+
System.out.
230+
231+
println(strings);
232+
```
233+
234+
#### Response
235+
236+
```
237+
[abcde, dede, deabc]
238+
```

0 commit comments

Comments
 (0)