docs: add parenthesis back to regex literal example ()

* fix: added parenthesis to literal notation example

* add prettier-ignore

---------

Co-authored-by: gtmnayan <50981692+gtm-nayan@users.noreply.github.com>
pull/9036/head
Kai Erik Niermann 2 years ago committed by GitHub
parent 7af165de09
commit 5cd4f7750e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

Loading…
Cancel
Save