Skip to content

Commit

Permalink
docs: add parenthesis back to regex literal example (#9027)
Browse files Browse the repository at this point in the history
* fix: added parenthesis to literal notation example

* add prettier-ignore

---------

Co-authored-by: gtmnayan <50981692+gtm-nayan@users.noreply.github.com>
  • Loading branch information
KaiErikNiermann and gtm-nayan authored Jul 24, 2023
1 parent 7af165d commit 5cd4f77
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion documentation/docs/02-template-syntax/02-basic-markup.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ Text can also contain JavaScript expressions:

> If you're using a regular expression (`RegExp`) [literal notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#literal_notation_and_constructor), you'll need to wrap it in parentheses.
<!-- prettier-ignore -->
```svelte
<h1>Hello {name}!</h1>
<p>{a} + {b} = {a + b}.</p>
<div>{/^[A-Za-z ]+$/.test(value) ? x : y}</div>
<div>{(/^[A-Za-z ]+$/).test(value) ? x : y}</div>
```

## Comments
Expand Down

0 comments on commit 5cd4f77

Please sign in to comment.