Skip to content

Commit 71357e5

Browse files
committed
Implement Builder Pattern for VerbalExpression + fix unit test
1 parent de00a86 commit 71357e5

File tree

4 files changed

+457
-437
lines changed

4 files changed

+457
-437
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ VerbalExpressions is a Java library that helps to construct difficult regular ex
66
##Examples
77
```java
88

9-
VerbalExpression testRegex = new VerbalExpression ()
9+
VerbalExpression testRegex = new VerbalExpression.Builder()
1010
.startOfLine()
1111
.then("http")
1212
.maybe("s")
1313
.then("://")
1414
.maybe("www.")
1515
.anythingBut(" ")
16-
.endOfLine();
16+
.endOfLine()
17+
.build();
1718

1819
// Create an example URL
1920
String url = "https://www.google.com";
@@ -25,10 +26,11 @@ testRegex.testExact(url); //True
2526
testRegex.toString(); // Ouputs the regex used:
2627
// ^(http)(s)?(\:\/\/)(www\.)?([^\ ]*)$
2728

28-
VerbalExpression testRegex = new VerbalExpression ()
29+
VerbalExpression testRegex = new VerbalExpression.Builder()
2930
.startOfLine()
3031
.then("abc")
31-
.or("def");
32+
.or("def")
33+
.build();
3234

3335
String testString = "defzzz";
3436

0 commit comments

Comments
 (0)