From 4f4877165d6611471583425018e88dc7e3a6436c Mon Sep 17 00:00:00 2001 From: Michael Dowling Date: Wed, 2 Dec 2020 13:09:29 -0800 Subject: [PATCH] Clarify pattern trait matching --- docs/source/1.0/spec/core/constraint-traits.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/source/1.0/spec/core/constraint-traits.rst b/docs/source/1.0/spec/core/constraint-traits.rst index b434b660e62..cd1f5171f89 100644 --- a/docs/source/1.0/spec/core/constraint-traits.rst +++ b/docs/source/1.0/spec/core/constraint-traits.rst @@ -406,6 +406,14 @@ conditionals, directives, recursion, lookahead, look-behind, back-references, and look-around in order to ensure maximum compatibility across programming languages. +.. important:: + + The ``pattern`` trait does not implicitly add a leading ``^`` or trailing + ``$`` to match an entire string. For example, ``@pattern("\\w+")`` matches + both "hello" and "!hello!" because it requires that just part of the + string matches the regular expression, whereas ``@pattern("^\\w+$")`` + requires that the entire string matches the regular expression. + .. tabs:: .. code-tab:: smithy