Skip to content

Commit 1b41636

Browse files
committed
Add usage example for Builder#capture(String) and getText(String, String)
1 parent 63ef6d7 commit 1b41636

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main/java/ru/lanwen/verbalregex/VerbalExpression.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,14 @@ public Builder capture() {
583583

584584
/**
585585
* Adds named-capture - open brace to current position and closed to suffixes
586+
* <p>
587+
* <pre>Example:{@code
588+
* String text = "[email protected]";
589+
* VerbalExpression regex = regex()
590+
* .find("@")
591+
* .capture("domain").anything().build();
592+
* regex.getText(text, "domain"); // => "example.com"
593+
* }</pre>
586594
*
587595
* @return this builder
588596
* @since 1.6
@@ -742,6 +750,8 @@ public String getText(final String toTest, final int group) {
742750

743751
/**
744752
* Extract exact named-group from string
753+
* <p>
754+
* Example is see to {@link Builder#capture(String)}
745755
*
746756
* @param toTest - string to extract from
747757
* @param group - group to extract

0 commit comments

Comments
 (0)