From 7e20f7d5aa0a7d4259192bd343347cf88cc24a00 Mon Sep 17 00:00:00 2001 From: Sam Gleske Date: Sun, 10 Dec 2023 10:15:36 -0500 Subject: [PATCH] Better docs for AutoRelease.isMatched --- .../gleske/jervis/tools/AutoRelease.groovy | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/groovy/net/gleske/jervis/tools/AutoRelease.groovy b/src/main/groovy/net/gleske/jervis/tools/AutoRelease.groovy index befda78f..c82dd196 100644 --- a/src/main/groovy/net/gleske/jervis/tools/AutoRelease.groovy +++ b/src/main/groovy/net/gleske/jervis/tools/AutoRelease.groovy @@ -434,7 +434,25 @@ fi /** Matches a string against an expression. This is typically used to - match branch names. + match branch names. It takes one of two forms: literal string and + regex pattern. Regex patterns require that the value start and end + with a forward slash. + + For example, +

+import static net.gleske.jervis.tools.AutoRelease.isMatched
+
+// basic literal evaluation
+assert isMatched('foo', 'bar') == false
+assert isMatched('foo', 'foo') == true
+
+// pattern matching because surrounded by /
+assert isMatched('/.*string$/', 'somestring') == true
+assert isMatched('/.*string$/', 'anotherstring') == true
+assert isMatched('/.*string$/', 'somestringvalue') == false
+
+ + @see java.util.regex.Pattern @param expression If the String starts and ends with a /, then it is treated as an expression for regex matching.