From aa9f7c2929e0a1458fa5242063684146ceda0593 Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Tue, 3 Nov 2020 19:53:22 +0700 Subject: [PATCH] docs: mention regexp literal as text expressions --- site/content/docs/02-template-syntax.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/site/content/docs/02-template-syntax.md b/site/content/docs/02-template-syntax.md index 119488aacc..97ba63f956 100644 --- a/site/content/docs/02-template-syntax.md +++ b/site/content/docs/02-template-syntax.md @@ -141,6 +141,13 @@ Text can also contain JavaScript expressions:

{a} + {b} = {a + b}.

``` +--- + +However, if you're using regular expression literal that starts with `/`, you'll need to wrap it in parentheses. + +```sv +
{(/^[A-Za-z ]+$/).test('value') ? 'foo' : 'bar'}
+``` ### Comments